get rid of QT3_SUPPORT and some cleanup

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14730 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-08-17 08:49:05 +00:00
parent 4a59eb800b
commit 773f079a56

View File

@ -11,18 +11,19 @@
#include <config.h> #include <config.h>
#include "iconpalette.h" #include "iconpalette.h"
#include "debug.h"
#include "qt_helpers.h" #include "qt_helpers.h"
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QPixmap> #include <QPixmap>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QGridLayout> #include <QGridLayout>
#include <QResizeEvent> #include <QResizeEvent>
#include <QLayout>
#include "debug.h" #include <QPushButton>
#include <QToolTip>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qtooltip.h>
using std::endl; using std::endl;
using std::make_pair; using std::make_pair;
@ -34,12 +35,14 @@ using std::vector;
int const button_size = 40; int const button_size = 40;
IconPalette::IconPalette(QWidget * parent, char const * name) IconPalette::IconPalette(QWidget * parent)
: QWidget(parent, name), maxcol_(-1) : QWidget(parent), maxcol_(-1)
{ {
QVBoxLayout * top = new QVBoxLayout(this); QVBoxLayout * top = new QVBoxLayout(this);
QHBoxLayout * row = new QHBoxLayout(top); QHBoxLayout * row = new QHBoxLayout(this);
layout_ = new QGridLayout(row); layout_ = new QGridLayout(this);
top->insertLayout(-1, row);
row->insertLayout(-1, layout_);
row->addStretch(0); row->addStretch(0);
top->addStretch(0); top->addStretch(0);
} }
@ -49,8 +52,8 @@ void IconPalette::add(QPixmap const & pixmap, string name, string tooltip)
{ {
QPushButton * p = new QPushButton(this); QPushButton * p = new QPushButton(this);
p->setFixedSize(button_size, button_size); p->setFixedSize(button_size, button_size);
p->setPixmap(pixmap); p->setIcon(QIcon(pixmap));
QToolTip::add(p, toqstr(tooltip)); p->setToolTip(toqstr(tooltip));
connect(p, SIGNAL(clicked()), this, SLOT(clicked())); connect(p, SIGNAL(clicked()), this, SLOT(clicked()));
buttons_.push_back(make_pair(p, name)); buttons_.push_back(make_pair(p, name));
} }
@ -93,10 +96,12 @@ void IconPalette::resizeEvent(QResizeEvent * e)
setUpdatesEnabled(false); setUpdatesEnabled(false);
// clear layout // clear layout
QLayoutIterator lit = layout_->iterator(); int i = 0;
while (lit.current()) { QLayoutItem *child;
lit.takeCurrent(); while ((child = layout_->itemAt(i)) != 0) {
} layout_->takeAt(i);
++i;
}
layout_->invalidate(); layout_->invalidate();