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