From: <hep...@us...> - 2008-11-28 01:47:01
|
Revision: 559 http://qterm.svn.sourceforge.net/qterm/?rev=559&view=rev Author: hephooey Date: 2008-11-28 01:46:57 +0000 (Fri, 28 Nov 2008) Log Message: ----------- Fix the toolbar size combo, the old code does not want to work apparently Modified Paths: -------------- trunk/qterm-qt4/src/toolbardialog.cpp Modified: trunk/qterm-qt4/src/toolbardialog.cpp =================================================================== --- trunk/qterm-qt4/src/toolbardialog.cpp 2008-11-27 21:51:09 UTC (rev 558) +++ trunk/qterm-qt4/src/toolbardialog.cpp 2008-11-28 01:46:57 UTC (rev 559) @@ -27,8 +27,10 @@ listAllActions->addItem("Separator"); QList<QToolBar*> toolbars = parent->findChildren<QToolBar*>(); - QToolBar* toolbar; + QToolBar* toolbar = NULL; + int index = 0; foreach(toolbar, toolbars) + index = toolbar->iconSize().height()/16-1; if (toolbar->objectName() != "customKeyToolBar") comboToolbars->addItem(toolbar->windowTitle(), QVariant::fromValue((QObject*)toolbar)); comboToolbarsCurrentIndexChanged(0); @@ -36,10 +38,7 @@ QMainWindow *mwParent = qobject_cast<QMainWindow*>(parent); comboButtonStyle->setCurrentIndex(int(mwParent->toolButtonStyle())); - QVariant size(mwParent->iconSize()); - for (int index = 0; index < comboIconSize->count(); index++) - if (size.toString() == comboIconSize->itemText(index)) - comboIconSize->setCurrentIndex(index); + comboIconSize->setCurrentIndex(index); connect(buttonUp, SIGNAL(clicked()), this, SLOT(buttonUpClicked())); connect(buttonDown, SIGNAL(clicked()), this, SLOT(buttonDownClicked())); connect(buttonAdd, SIGNAL(clicked()), this, SLOT(buttonAddClicked())); @@ -173,10 +172,20 @@ void ToolbarDialog::comboIconSizeCurrentIndexChanged(const QString& item) { - QVariant v; - v.setValue(item); - QMainWindow *parent = qobject_cast<QMainWindow*>(parentWidget()); - parent->setIconSize(v.toSize()); + //QMainWindow *parent = qobject_cast<QMainWindow*>(parentWidget()); + QSize iconSize; + if (item == "16x16") + iconSize = QSize(16,16); + else if (item == "32x32") + iconSize = QSize(32,32); + else if (item == "48x48") + iconSize = QSize(48,48); + else + iconSize = QSize(16,16); + QList<QToolBar*> toolbars = parent()->findChildren<QToolBar*>(); + QToolBar* toolbar; + foreach(toolbar, toolbars) + toolbar->setIconSize(iconSize); } void ToolbarDialog::comboToolbarsCurrentIndexChanged(int index) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |