Commit dc224f47 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Fix KoTagChooserWidget not selecting items for tags that don't fit

BUG:408053
parent b1cdd068
...@@ -57,7 +57,7 @@ KisDlgPngImport::KisDlgPngImport(const QString &path, const QString &colorModelI ...@@ -57,7 +57,7 @@ KisDlgPngImport::KisDlgPngImport(const QString &path, const QString &colorModelI
QString KisDlgPngImport::profile() const QString KisDlgPngImport::profile() const
{ {
QString p = dlgWidget.cmbProfile->itemHighlighted(); QString p = dlgWidget.cmbProfile->currentUnsqueezedText();
KisConfig cfg(false); KisConfig cfg(false);
cfg.writeEntry("pngImportProfile", p); cfg.writeEntry("pngImportProfile", p);
return p; return p;
......
...@@ -1652,7 +1652,7 @@ bool KisDlgPreferences::editPreferences() ...@@ -1652,7 +1652,7 @@ bool KisDlgPreferences::editPreferences()
} }
else { else {
cfg.setMonitorProfile(i, cfg.setMonitorProfile(i,
dialog->m_colorSettings->m_monitorProfileWidgets[i]->itemHighlighted(), dialog->m_colorSettings->m_monitorProfileWidgets[i]->currentUnsqueezedText(),
dialog->m_colorSettings->m_page->chkUseSystemMonitorProfile->isChecked()); dialog->m_colorSettings->m_page->chkUseSystemMonitorProfile->isChecked());
} }
} }
......
...@@ -90,7 +90,7 @@ KisColorSpaceSelector::~KisColorSpaceSelector() ...@@ -90,7 +90,7 @@ KisColorSpaceSelector::~KisColorSpaceSelector()
void KisColorSpaceSelector::fillCmbProfiles() void KisColorSpaceSelector::fillCmbProfiles()
{ {
const QString currentProfileName = d->colorSpaceSelector->cmbProfile->itemHighlighted(); const QString currentProfileName = d->colorSpaceSelector->cmbProfile->currentUnsqueezedText();
const QString colorSpaceId = KoColorSpaceRegistry::instance()->colorSpaceId(d->colorSpaceSelector->cmbColorModels->currentItem(), d->colorSpaceSelector->cmbColorDepth->currentItem()); const QString colorSpaceId = KoColorSpaceRegistry::instance()->colorSpaceId(d->colorSpaceSelector->cmbColorModels->currentItem(), d->colorSpaceSelector->cmbColorDepth->currentItem());
const QString defaultProfileName = KoColorSpaceRegistry::instance()->defaultProfileForColorSpace(colorSpaceId); const QString defaultProfileName = KoColorSpaceRegistry::instance()->defaultProfileForColorSpace(colorSpaceId);
...@@ -133,7 +133,7 @@ void KisColorSpaceSelector::fillCmbDepths(const KoID& id) ...@@ -133,7 +133,7 @@ void KisColorSpaceSelector::fillCmbDepths(const KoID& id)
const KoColorSpace* KisColorSpaceSelector::currentColorSpace() const KoColorSpace* KisColorSpaceSelector::currentColorSpace()
{ {
QString profilenamestring = d->colorSpaceSelector->cmbProfile->itemHighlighted(); QString profilenamestring = d->colorSpaceSelector->cmbProfile->currentUnsqueezedText();
if (profilenamestring.contains(d->defaultsuffix)) { if (profilenamestring.contains(d->defaultsuffix)) {
profilenamestring.remove(d->defaultsuffix); profilenamestring.remove(d->defaultsuffix);
return KoColorSpaceRegistry::instance()->colorSpace( return KoColorSpaceRegistry::instance()->colorSpace(
......
...@@ -54,7 +54,6 @@ KoTagChooserWidget::KoTagChooserWidget(QWidget* parent): QWidget(parent) ...@@ -54,7 +54,6 @@ KoTagChooserWidget::KoTagChooserWidget(QWidget* parent): QWidget(parent)
d->comboBox->setToolTip(i18n("Tag")); d->comboBox->setToolTip(i18n("Tag"));
d->comboBox->setSizePolicy(QSizePolicy::MinimumExpanding , QSizePolicy::Fixed ); d->comboBox->setSizePolicy(QSizePolicy::MinimumExpanding , QSizePolicy::Fixed );
QGridLayout* comboLayout = new QGridLayout(this); QGridLayout* comboLayout = new QGridLayout(this);
comboLayout->addWidget(d->comboBox, 0, 0); comboLayout->addWidget(d->comboBox, 0, 0);
...@@ -68,8 +67,7 @@ KoTagChooserWidget::KoTagChooserWidget(QWidget* parent): QWidget(parent) ...@@ -68,8 +67,7 @@ KoTagChooserWidget::KoTagChooserWidget(QWidget* parent): QWidget(parent)
this->setEnabled(true); this->setEnabled(true);
clear(); clear();
connect(d->comboBox, SIGNAL(currentTextChanged(QString)), connect(d->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(tagChanged(int)));
this, SIGNAL(tagChosen(QString)));
connect(d->tagToolButton, SIGNAL(popupMenuAboutToShow()), connect(d->tagToolButton, SIGNAL(popupMenuAboutToShow()),
this, SLOT (tagOptionsContextMenuAboutToShow())); this, SLOT (tagOptionsContextMenuAboutToShow()));
...@@ -99,6 +97,11 @@ void KoTagChooserWidget::contextDeleteCurrentTag() ...@@ -99,6 +97,11 @@ void KoTagChooserWidget::contextDeleteCurrentTag()
emit tagDeletionRequested(currentlySelectedTag()); emit tagDeletionRequested(currentlySelectedTag());
} }
void KoTagChooserWidget::tagChanged(int)
{
emit tagChosen(d->comboBox->currentUnsqueezedText());
}
void KoTagChooserWidget::tagRenamingRequested(const QString& newName) void KoTagChooserWidget::tagRenamingRequested(const QString& newName)
{ {
if (newName.isEmpty() || selectedTagIsReadOnly()) { if (newName.isEmpty() || selectedTagIsReadOnly()) {
...@@ -145,7 +148,7 @@ void KoTagChooserWidget::insertItem(QString tagName) ...@@ -145,7 +148,7 @@ void KoTagChooserWidget::insertItem(QString tagName)
QString KoTagChooserWidget::currentlySelectedTag() QString KoTagChooserWidget::currentlySelectedTag()
{ {
return d->comboBox->itemHighlighted(); return d->comboBox->currentUnsqueezedText();
} }
QStringList KoTagChooserWidget::allTags() QStringList KoTagChooserWidget::allTags()
...@@ -155,7 +158,7 @@ QStringList KoTagChooserWidget::allTags() ...@@ -155,7 +158,7 @@ QStringList KoTagChooserWidget::allTags()
bool KoTagChooserWidget::selectedTagIsReadOnly() bool KoTagChooserWidget::selectedTagIsReadOnly()
{ {
return d->readOnlyTags.contains(d->comboBox->itemHighlighted()) ; return d->readOnlyTags.contains(d->comboBox->currentUnsqueezedText()) ;
} }
void KoTagChooserWidget::addItems(QStringList tagNames) void KoTagChooserWidget::addItems(QStringList tagNames)
......
...@@ -62,6 +62,7 @@ private Q_SLOTS: ...@@ -62,6 +62,7 @@ private Q_SLOTS:
void tagRenamingRequested(const QString &newName); void tagRenamingRequested(const QString &newName);
void tagOptionsContextMenuAboutToShow(); void tagOptionsContextMenuAboutToShow();
void contextDeleteCurrentTag(); void contextDeleteCurrentTag();
void tagChanged(int index);
private: private:
class Private; class Private;
......
...@@ -166,7 +166,7 @@ QString KisSqueezedComboBox::squeezeText(const QString& original, const QWidget ...@@ -166,7 +166,7 @@ QString KisSqueezedComboBox::squeezeText(const QString& original, const QWidget
return sqItem; return sqItem;
} }
QString KisSqueezedComboBox::itemHighlighted() QString KisSqueezedComboBox::currentUnsqueezedText()
{ {
int curItem = currentIndex(); int curItem = currentIndex();
return m_originalItems[curItem]; return m_originalItems[curItem];
......
...@@ -126,7 +126,7 @@ public: ...@@ -126,7 +126,7 @@ public:
* highlighted item. * highlighted item.
* @return full text of the highlighted item * @return full text of the highlighted item
*/ */
QString itemHighlighted(); QString currentUnsqueezedText();
/** /**
* remove the squeezed item at index * remove the squeezed item at index
......
...@@ -464,10 +464,10 @@ void LutDockerDock::writeControls() ...@@ -464,10 +464,10 @@ void LutDockerDock::writeControls()
ocioOptions.mode = (KisOcioConfiguration::Mode)m_colorManagement->currentIndex(); ocioOptions.mode = (KisOcioConfiguration::Mode)m_colorManagement->currentIndex();
ocioOptions.configurationPath = m_txtConfigurationPath->text(); ocioOptions.configurationPath = m_txtConfigurationPath->text();
ocioOptions.lutPath = m_txtLut->text(); ocioOptions.lutPath = m_txtLut->text();
ocioOptions.inputColorSpace = m_cmbInputColorSpace->itemHighlighted(); ocioOptions.inputColorSpace = m_cmbInputColorSpace->currentUnsqueezedText();
ocioOptions.displayDevice = m_cmbDisplayDevice->itemHighlighted(); ocioOptions.displayDevice = m_cmbDisplayDevice->currentUnsqueezedText();
ocioOptions.displayView = m_cmbView->itemHighlighted(); ocioOptions.displayView = m_cmbView->currentUnsqueezedText();
ocioOptions.look = m_cmbLook->itemHighlighted(); ocioOptions.look = m_cmbLook->currentUnsqueezedText();
KisConfig cfg(false); KisConfig cfg(false);
cfg.setUseOcio(m_chkUseOcio->isChecked()); cfg.setUseOcio(m_chkUseOcio->isChecked());
......
...@@ -182,7 +182,7 @@ void SqueezedComboBox::slotUpdateToolTip(int index) ...@@ -182,7 +182,7 @@ void SqueezedComboBox::slotUpdateToolTip(int index)
setToolTip(d->originalItems[index]); setToolTip(d->originalItems[index]);
} }
QString SqueezedComboBox::itemHighlighted() const QString SqueezedComboBox::currentUnsqueezedText() const
{ {
int curItem = currentIndex(); int curItem = currentIndex();
return d->originalItems[curItem]; return d->originalItems[curItem];
......
...@@ -118,7 +118,7 @@ public: ...@@ -118,7 +118,7 @@ public:
* highlighted item. * highlighted item.
* @return full text of the highlighted item * @return full text of the highlighted item
*/ */
QString itemHighlighted() const; QString currentUnsqueezedText() const;
/** /**
* This method returns the full text (not squeezed) for the index. * This method returns the full text (not squeezed) for the index.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment