

Definition at line 110 of file propertyeditor.cpp.
Signals | |
| void | iconChanged (const QIcon &pm) |
| void | pixmapChanged (const QPixmap &pm) |
Public Member Functions | |
| GraphicsPropertyEditor (QDesignerFormEditorInterface *core, const QIcon &pm, QWidget *parent) | |
| GraphicsPropertyEditor (QDesignerFormEditorInterface *core, const QPixmap &pixmap, QWidget *parent) | |
| ~GraphicsPropertyEditor () | |
| void | setIcon (const QIcon &pm) |
| void | setPixmap (const QPixmap &pm) |
| QIcon | icon () const |
| QPixmap | pixmap () const |
Private Types | |
| enum | Mode |
Private Slots | |
| void | showDialog () |
| void | comboActivated (int idx) |
Private Member Functions | |
| void | init () |
| void | populateCombo () |
| int | indexOfIcon (const QIcon &icon) |
| int | indexOfPixmap (const QPixmap &pixmap) |
Private Attributes | |
| Mode | m_mode |
| QDesignerFormEditorInterface * | m_core |
| QComboBox * | m_combo |
| QToolButton * | m_button |
| QIcon | m_icon |
| QPixmap | m_pixmap |
enum qdesigner_internal::GraphicsPropertyEditor::Mode [private] |
| qdesigner_internal::GraphicsPropertyEditor::GraphicsPropertyEditor | ( | QDesignerFormEditorInterface * | core, | |
| const QIcon & | pm, | |||
| QWidget * | parent | |||
| ) |
| qdesigner_internal::GraphicsPropertyEditor::GraphicsPropertyEditor | ( | QDesignerFormEditorInterface * | core, | |
| const QPixmap & | pixmap, | |||
| QWidget * | parent | |||
| ) |
| qdesigner_internal::GraphicsPropertyEditor::~GraphicsPropertyEditor | ( | ) |
| void qdesigner_internal::GraphicsPropertyEditor::setIcon | ( | const QIcon & | pm | ) |
Definition at line 322 of file propertyeditor.cpp.
References QObject::blockSignals(), emit, iconChanged(), indexOfIcon(), QIcon::isNull(), m_combo, m_icon, m_mode, Pixmap, QIcon::serialNumber(), and QComboBox::setCurrentIndex().
Referenced by comboActivated(), GraphicsPropertyEditor(), and showDialog().
00323 { 00324 if (m_mode == Pixmap) 00325 return; 00326 00327 if (pm.isNull() && m_icon.isNull()) 00328 return; 00329 if (pm.serialNumber() == m_icon.serialNumber()) 00330 return; 00331 00332 m_icon = pm; 00333 00334 bool blocked = m_combo->blockSignals(true); 00335 m_combo->setCurrentIndex(indexOfIcon(m_icon)); 00336 m_combo->blockSignals(blocked); 00337 00338 emit iconChanged(m_icon); 00339 }
Here is the call graph for this function:

| void qdesigner_internal::GraphicsPropertyEditor::setPixmap | ( | const QPixmap & | pm | ) |
Definition at line 341 of file propertyeditor.cpp.
References QObject::blockSignals(), emit, Icon, indexOfPixmap(), QPixmap::isNull(), m_combo, m_mode, m_pixmap, pixmapChanged(), QPixmap::serialNumber(), and QComboBox::setCurrentIndex().
Referenced by comboActivated(), GraphicsPropertyEditor(), and showDialog().
00342 { 00343 if (m_mode == Icon) 00344 return; 00345 00346 if (pm.isNull() && m_pixmap.isNull()) 00347 return; 00348 if (pm.serialNumber() == m_pixmap.serialNumber()) 00349 return; 00350 00351 m_pixmap = pm; 00352 00353 bool blocked = m_combo->blockSignals(true); 00354 m_combo->setCurrentIndex(indexOfPixmap(m_pixmap)); 00355 m_combo->blockSignals(blocked); 00356 00357 emit pixmapChanged(m_pixmap); 00358 }
Here is the call graph for this function:

| QIcon qdesigner_internal::GraphicsPropertyEditor::icon | ( | ) | const [inline] |
Definition at line 120 of file propertyeditor.cpp.
Referenced by indexOfIcon(), populateCombo(), and showDialog().
| QPixmap qdesigner_internal::GraphicsPropertyEditor::pixmap | ( | ) | const [inline] |
Definition at line 121 of file propertyeditor.cpp.
Referenced by indexOfPixmap(), populateCombo(), and showDialog().
| void qdesigner_internal::GraphicsPropertyEditor::iconChanged | ( | const QIcon & | pm | ) | [signal] |
Referenced by setIcon().
| void qdesigner_internal::GraphicsPropertyEditor::pixmapChanged | ( | const QPixmap & | pm | ) | [signal] |
Referenced by setPixmap().
| void qdesigner_internal::GraphicsPropertyEditor::showDialog | ( | ) | [private, slot] |
Definition at line 285 of file propertyeditor.cpp.
References QDesignerFormWindowManagerInterface::activeFormWindow(), QDialog::exec(), qdesigner_internal::FindIconDialog::filePath(), form(), QDesignerFormEditorInterface::formWindowManager(), icon(), Icon, QDesignerFormEditorInterface::iconCache(), QDesignerIconCacheInterface::iconToFilePath(), QDesignerIconCacheInterface::iconToQrcPath(), QString::isEmpty(), QIcon::isNull(), QPixmap::isNull(), m_core, m_icon, m_mode, m_pixmap, QDesignerIconCacheInterface::nameToIcon(), QDesignerIconCacheInterface::nameToPixmap(), pixmap(), QDesignerIconCacheInterface::pixmapToFilePath(), QDesignerIconCacheInterface::pixmapToQrcPath(), populateCombo(), qdesigner_internal::FindIconDialog::qrcPath(), setIcon(), qdesigner_internal::FindIconDialog::setPaths(), and setPixmap().
Referenced by init().
00286 { 00287 QDesignerFormWindowInterface *form = m_core->formWindowManager()->activeFormWindow(); 00288 if (form == 0) 00289 return; 00290 00291 QString file_path; 00292 QString qrc_path; 00293 00294 if (m_mode == Icon && !m_icon.isNull()) { 00295 file_path = m_core->iconCache()->iconToFilePath(m_icon); 00296 qrc_path = m_core->iconCache()->iconToQrcPath(m_icon); 00297 } else if (!m_pixmap.isNull()) { 00298 file_path = m_core->iconCache()->pixmapToFilePath(m_pixmap); 00299 qrc_path = m_core->iconCache()->pixmapToQrcPath(m_pixmap); 00300 } 00301 00302 FindIconDialog dialog(form, 0); 00303 dialog.setPaths(qrc_path, file_path); 00304 if (dialog.exec()) { 00305 file_path = dialog.filePath(); 00306 qrc_path = dialog.qrcPath(); 00307 if (!file_path.isEmpty()) { 00308 populateCombo(); 00309 if (m_mode == Icon) { 00310 QIcon icon = m_core->iconCache()->nameToIcon(file_path, qrc_path); 00311 populateCombo(); 00312 setIcon(icon); 00313 } else { 00314 QPixmap pixmap = m_core->iconCache()->nameToPixmap(file_path, qrc_path); 00315 populateCombo(); 00316 setPixmap(pixmap); 00317 } 00318 } 00319 } 00320 }
| void qdesigner_internal::GraphicsPropertyEditor::comboActivated | ( | int | idx | ) | [private, slot] |
Definition at line 173 of file propertyeditor.cpp.
References Icon, QComboBox::itemData(), m_combo, m_mode, setIcon(), and setPixmap().
Referenced by init().
00174 { 00175 if (m_mode == Icon) { 00176 setIcon(qvariant_cast<QIcon>(m_combo->itemData(idx))); 00177 } else { 00178 setPixmap(qvariant_cast<QPixmap>(m_combo->itemData(idx))); 00179 } 00180 }
| void qdesigner_internal::GraphicsPropertyEditor::init | ( | ) | [private] |
Definition at line 151 of file propertyeditor.cpp.
References QLayout::addWidget(), comboActivated(), QObject::connect(), qdesigner_internal::createIconSet(), QSizePolicy::Expanding, QSizePolicy::Fixed, QWidget::layout(), m_button, m_combo, QSizePolicy::MinimumExpanding, populateCombo(), QComboBox::setEditable(), QWidget::setFixedWidth(), QComboBox::setFrame(), QAbstractButton::setIcon(), QLayout::setMargin(), QWidget::setSizePolicy(), QLayout::setSpacing(), showDialog(), SIGNAL, and SLOT.
Referenced by GraphicsPropertyEditor().
00152 { 00153 QHBoxLayout *layout = new QHBoxLayout(this); 00154 layout->setMargin(0); 00155 layout->setSpacing(0); 00156 00157 m_combo = new QComboBox(this); 00158 m_combo->setFrame(0); 00159 m_combo->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); 00160 m_combo->setEditable(false); 00161 layout->addWidget(m_combo); 00162 m_button = new QToolButton(this); 00163 m_button->setIcon(createIconSet(QLatin1String("fileopen.png"))); 00164 m_button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding); 00165 m_button->setFixedWidth(20); 00166 layout->addWidget(m_button); 00167 connect(m_button, SIGNAL(clicked()), this, SLOT(showDialog())); 00168 connect(m_combo, SIGNAL(activated(int)), this, SLOT(comboActivated(int))); 00169 00170 populateCombo(); 00171 }
Here is the call graph for this function:

| void qdesigner_internal::GraphicsPropertyEditor::populateCombo | ( | ) | [private] |
Definition at line 228 of file propertyeditor.cpp.
References QDesignerFormWindowManagerInterface::activeFormWindow(), QComboBox::addItem(), QObject::blockSignals(), QComboBox::clear(), QStringList::contains(), form(), QDesignerFormEditorInterface::formWindowManager(), icon(), Icon, QDesignerFormEditorInterface::iconCache(), QDesignerIconCacheInterface::iconList(), QDesignerIconCacheInterface::iconToFilePath(), QDesignerIconCacheInterface::iconToQrcPath(), QString::isEmpty(), m_combo, m_core, m_mode, pixmap(), QDesignerIconCacheInterface::pixmapList(), QDesignerIconCacheInterface::pixmapToFilePath(), and QComboBox::setCurrentIndex().
Referenced by indexOfIcon(), indexOfPixmap(), init(), and showDialog().
00229 { 00230 QDesignerFormWindowInterface *form = m_core->formWindowManager()->activeFormWindow(); 00231 if (form == 0) 00232 return; 00233 QStringList qrc_list = form->resourceFiles(); 00234 00235 m_combo->clear(); 00236 00237 QDesignerIconCacheInterface *cache = m_core->iconCache(); 00238 if (m_mode == Icon) { 00239 m_combo->addItem(tr("<no icon>")); 00240 QList<QIcon> icon_list = cache->iconList(); 00241 foreach (QIcon icon, icon_list) { 00242 QString qrc_path = cache->iconToQrcPath(icon); 00243 if (!qrc_path.isEmpty() && !qrc_list.contains(qrc_path)) 00244 continue; 00245 m_combo->addItem(icon, QFileInfo(cache->iconToFilePath(icon)).fileName(), 00246 QVariant(icon)); 00247 } 00248 } else { 00249 m_combo->addItem(tr("<no pixmap>")); 00250 QList<QPixmap> pixmap_list = cache->pixmapList(); 00251 foreach (QPixmap pixmap, pixmap_list) { 00252 QString qrc_path = cache->iconToQrcPath(pixmap); 00253 if (!qrc_path.isEmpty() && !qrc_list.contains(qrc_path)) 00254 continue; 00255 m_combo->addItem(QIcon(pixmap), 00256 QFileInfo(cache->pixmapToFilePath(pixmap)).fileName(), 00257 QVariant(pixmap)); 00258 } 00259 } 00260 bool blocked = m_combo->blockSignals(true); 00261 m_combo->setCurrentIndex(0); 00262 m_combo->blockSignals(blocked); 00263 }
Here is the call graph for this function:

| int qdesigner_internal::GraphicsPropertyEditor::indexOfIcon | ( | const QIcon & | icon | ) | [private] |
Definition at line 182 of file propertyeditor.cpp.
References QComboBox::count(), i, icon(), QIcon::isNull(), QComboBox::itemData(), m_combo, m_mode, Pixmap, populateCombo(), and QIcon::serialNumber().
Referenced by setIcon().
00183 { 00184 if (m_mode == Pixmap) 00185 return -1; 00186 00187 if (icon.isNull()) 00188 return 0; 00189 00190 for (int i = 1; i < m_combo->count(); ++i) { 00191 if (qvariant_cast<QIcon>(m_combo->itemData(i)).serialNumber() == icon.serialNumber()) 00192 return i; 00193 } 00194 00195 populateCombo(); 00196 00197 for (int i = 1; i < m_combo->count(); ++i) { 00198 if (qvariant_cast<QIcon>(m_combo->itemData(i)).serialNumber() == icon.serialNumber()) 00199 return i; 00200 } 00201 00202 return -1; 00203 }
Here is the call graph for this function:

| int qdesigner_internal::GraphicsPropertyEditor::indexOfPixmap | ( | const QPixmap & | pixmap | ) | [private] |
Definition at line 205 of file propertyeditor.cpp.
References QComboBox::count(), i, Icon, QPixmap::isNull(), QComboBox::itemData(), m_combo, m_mode, pixmap(), populateCombo(), and QPixmap::serialNumber().
Referenced by setPixmap().
00206 { 00207 if (m_mode == Icon) 00208 return -1; 00209 00210 if (pixmap.isNull()) 00211 return 0; 00212 00213 for (int i = 1; i < m_combo->count(); ++i) { 00214 if (qvariant_cast<QPixmap>(m_combo->itemData(i)).serialNumber() == pixmap.serialNumber()) 00215 return i; 00216 } 00217 00218 populateCombo(); 00219 00220 for (int i = 1; i < m_combo->count(); ++i) { 00221 if (qvariant_cast<QPixmap>(m_combo->itemData(i)).serialNumber() == pixmap.serialNumber()) 00222 return i; 00223 } 00224 00225 return -1; 00226 }
Here is the call graph for this function:

Definition at line 138 of file propertyeditor.cpp.
Referenced by comboActivated(), GraphicsPropertyEditor(), indexOfIcon(), indexOfPixmap(), populateCombo(), setIcon(), setPixmap(), and showDialog().
Definition at line 140 of file propertyeditor.cpp.
Referenced by GraphicsPropertyEditor(), populateCombo(), and showDialog().
Definition at line 141 of file propertyeditor.cpp.
Referenced by comboActivated(), indexOfIcon(), indexOfPixmap(), init(), populateCombo(), setIcon(), and setPixmap().
1.5.1