From 773f079a5601dad651ba9e8e7b6995dff26fb30d Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Thu, 17 Aug 2006 08:49:05 +0000 Subject: [PATCH] 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 --- src/frontends/qt4/iconpalette.C | 37 +++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/frontends/qt4/iconpalette.C b/src/frontends/qt4/iconpalette.C index c3c508c2ce..58ba688401 100644 --- a/src/frontends/qt4/iconpalette.C +++ b/src/frontends/qt4/iconpalette.C @@ -11,18 +11,19 @@ #include #include "iconpalette.h" + +#include "debug.h" + #include "qt_helpers.h" + #include #include #include #include #include - -#include "debug.h" - -#include -#include -#include +#include +#include +#include using std::endl; using std::make_pair; @@ -34,12 +35,14 @@ using std::vector; int const button_size = 40; -IconPalette::IconPalette(QWidget * parent, char const * name) - : QWidget(parent, name), maxcol_(-1) +IconPalette::IconPalette(QWidget * parent) + : QWidget(parent), maxcol_(-1) { QVBoxLayout * top = new QVBoxLayout(this); - QHBoxLayout * row = new QHBoxLayout(top); - layout_ = new QGridLayout(row); + QHBoxLayout * row = new QHBoxLayout(this); + layout_ = new QGridLayout(this); + top->insertLayout(-1, row); + row->insertLayout(-1, layout_); row->addStretch(0); top->addStretch(0); } @@ -49,8 +52,8 @@ void IconPalette::add(QPixmap const & pixmap, string name, string tooltip) { QPushButton * p = new QPushButton(this); p->setFixedSize(button_size, button_size); - p->setPixmap(pixmap); - QToolTip::add(p, toqstr(tooltip)); + p->setIcon(QIcon(pixmap)); + p->setToolTip(toqstr(tooltip)); connect(p, SIGNAL(clicked()), this, SLOT(clicked())); buttons_.push_back(make_pair(p, name)); } @@ -93,10 +96,12 @@ void IconPalette::resizeEvent(QResizeEvent * e) setUpdatesEnabled(false); // clear layout - QLayoutIterator lit = layout_->iterator(); - while (lit.current()) { - lit.takeCurrent(); - } + int i = 0; + QLayoutItem *child; + while ((child = layout_->itemAt(i)) != 0) { + layout_->takeAt(i); + ++i; + } layout_->invalidate();