IconSelectButton(QWidget *parent) : QAbstractButton(parent) { ic = 0; animated = false; connect (this, SIGNAL(clicked()), SLOT(iconSelected())); }
void IconSelectButton::onClicked() { QScopedPointer<IconSelectDialog> dialog( new IconSelectDialog(m_currentIcon, this) ); dialog->setAttribute(Qt::WA_DeleteOnClose, true); connect(dialog.data(), SIGNAL(iconSelected(QString)), this, SLOT(setCurrentIcon(QString))); dialog->open(); dialog.take(); }
void IconSelectDialog::done(int result) { saveWindowGeometry(this, false); if (result == QDialog::Accepted) emit iconSelected(m_selectedIcon); QDialog::done(result); }
void CustomToolBarPropertiesDialog::iconButtonClicked() { KviImageDialog * dlg = new KviImageDialog(this,__tr2qs_ctx("Please choose the icon for the ToolBar","editor")); if(dlg->exec() != QDialog::Accepted) { delete dlg; return; } QString s = dlg->selectedImage(); delete dlg; iconSelected(s); }
CustomToolBarPropertiesDialog::CustomToolBarPropertiesDialog(QWidget * p,const QString &szText,const QString &szId,const QString &szLabel,const QString &szIconId) : QDialog(p) { m_szId = szId; m_szOriginalId = szId; m_szLabel = szLabel; setWindowTitle(__tr2qs_ctx("ToolBar Properties","editor")); setWindowIcon(QIcon(*(g_pIconManager->getSmallIcon(KviIconManager::ToolBar)))); setModal(true); QGridLayout * g = new QGridLayout(this); QLabel * l = new QLabel(szText,this); g->addWidget(l,0,0,1,6); l = new QLabel(__tr2qs_ctx("Label","editor") + ":",this); g->addWidget(l,1,0); m_pLabelEdit = new QLineEdit(this); g->addWidget(m_pLabelEdit,1,1,1,5); m_pLabelEdit->setText(szLabel); connect(m_pLabelEdit,SIGNAL(textChanged(const QString &)),this,SLOT(labelTextChanged(const QString &))); l = new QLabel(__tr2qs_ctx("Icon","editor") + ":",this); g->addWidget(l,2,0); m_pIconEdit = new QLineEdit(this); m_pIconEdit->setReadOnly(true); g->addWidget(m_pIconEdit,2,1,1,4); m_pIconButton = new QPushButton(this); g->addWidget(m_pIconButton,2,5,1,1); connect(m_pIconButton,SIGNAL(clicked()),this,SLOT(iconButtonClicked())); iconSelected(szIconId); m_pAdvanced = new QWidget(this); QGridLayout * ag = new QGridLayout(m_pAdvanced); l = new QLabel(__tr2qs_ctx("Id","editor") + ":",m_pAdvanced); l->setMinimumWidth(100); ag->addWidget(l,0,0); m_pIdEdit = new QLineEdit(m_pAdvanced); ag->addWidget(m_pIdEdit,0,1); ag->setRowStretch(0,1); m_pIdEdit->setText(szId); g->addWidget(m_pAdvanced,3,0,1,6); m_pAdvanced->hide(); m_pLabelEdit->setFocus(); QPushButton * pb = new QPushButton(__tr2qs_ctx("OK","editor"),this); connect(pb,SIGNAL(clicked()),this,SLOT(okClicked())); pb->setMinimumWidth(80); g->addWidget(pb,4,4,1,2); pb = new QPushButton(__tr2qs_ctx("Cancel","editor"),this); connect(pb,SIGNAL(clicked()),this,SLOT(reject())); pb->setMinimumWidth(80); g->addWidget(pb,4,3); m_pAdvancedButton = new QPushButton(__tr2qs_ctx("Advanced...","editor"),this); connect(m_pAdvancedButton,SIGNAL(clicked()),this,SLOT(advancedClicked())); m_pAdvancedButton->setMinimumWidth(100); g->addWidget(m_pAdvancedButton,4,0,1,2); g->setRowStretch(0,1); g->setColumnStretch(2,1); }