Changeset View
Changeset View
Standalone View
Standalone View
conf/widgetdrawingtools.cpp
Show First 20 Lines • Show All 89 Lines • ▼ Show 20 Line(s) | 89 | { | |||
---|---|---|---|---|---|
90 | const QString name = toolElement.attribute( QStringLiteral("name") ); | 90 | const QString name = toolElement.attribute( QStringLiteral("name") ); | ||
91 | QString itemText; | 91 | QString itemText; | ||
92 | if ( toolElement.attribute( QStringLiteral("default"), QStringLiteral("false") ) == QLatin1String("true") ) | 92 | if ( toolElement.attribute( QStringLiteral("default"), QStringLiteral("false") ) == QLatin1String("true") ) | ||
93 | itemText = i18n( name.toLatin1().constData() ); | 93 | itemText = i18n( name.toLatin1().constData() ); | ||
94 | else | 94 | else | ||
95 | itemText = name; | 95 | itemText = name; | ||
96 | 96 | | |||
97 | QListWidgetItem * listEntry = new QListWidgetItem( itemText, m_list ); | 97 | QListWidgetItem * listEntry = new QListWidgetItem( itemText, m_list ); | ||
98 | listEntry->setData( ToolXmlRole, qVariantFromValue( toolXml ) ); | 98 | listEntry->setData( ToolXmlRole, QVariant::fromValue( toolXml ) ); | ||
99 | listEntry->setData( Qt::DecorationRole, colorDecorationFromToolDescription( toolXml ) ); | 99 | listEntry->setData( Qt::DecorationRole, colorDecorationFromToolDescription( toolXml ) ); | ||
100 | } | 100 | } | ||
101 | } | 101 | } | ||
102 | 102 | | |||
103 | updateButtons(); | 103 | updateButtons(); | ||
104 | } | 104 | } | ||
105 | 105 | | |||
106 | QString WidgetDrawingTools::defaultName() const | 106 | QString WidgetDrawingTools::defaultName() const | ||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 129 | { | |||
152 | } | 152 | } | ||
153 | 153 | | |||
154 | // Store name attribute only if the user specified a customized name | 154 | // Store name attribute only if the user specified a customized name | ||
155 | toolElement.setAttribute( QStringLiteral("name"), itemText ); | 155 | toolElement.setAttribute( QStringLiteral("name"), itemText ); | ||
156 | 156 | | |||
157 | // Create list entry and attach XML string as data | 157 | // Create list entry and attach XML string as data | ||
158 | const QString toolXml = rootDoc.toString( -1 ); | 158 | const QString toolXml = rootDoc.toString( -1 ); | ||
159 | QListWidgetItem * listEntry = new QListWidgetItem( itemText, m_list ); | 159 | QListWidgetItem * listEntry = new QListWidgetItem( itemText, m_list ); | ||
160 | listEntry->setData( ToolXmlRole, qVariantFromValue( toolXml ) ); | 160 | listEntry->setData( ToolXmlRole, QVariant::fromValue( toolXml ) ); | ||
161 | listEntry->setData( Qt::DecorationRole, colorDecorationFromToolDescription( toolXml ) ); | 161 | listEntry->setData( Qt::DecorationRole, colorDecorationFromToolDescription( toolXml ) ); | ||
162 | 162 | | |||
163 | // Select and scroll | 163 | // Select and scroll | ||
164 | m_list->setCurrentItem( listEntry ); | 164 | m_list->setCurrentItem( listEntry ); | ||
165 | m_list->scrollToItem( listEntry ); | 165 | m_list->scrollToItem( listEntry ); | ||
166 | updateButtons(); | 166 | updateButtons(); | ||
167 | emit changed(); | 167 | emit changed(); | ||
168 | } | 168 | } | ||
Show All 27 Lines | 171 | { | |||
196 | } | 196 | } | ||
197 | 197 | | |||
198 | // Store name attribute only if the user specified a customized name | 198 | // Store name attribute only if the user specified a customized name | ||
199 | toolElement.setAttribute( QStringLiteral("name"), itemText ); | 199 | toolElement.setAttribute( QStringLiteral("name"), itemText ); | ||
200 | 200 | | |||
201 | // Edit list entry and attach XML string as data | 201 | // Edit list entry and attach XML string as data | ||
202 | const QString toolXml = doc.toString( -1 ); | 202 | const QString toolXml = doc.toString( -1 ); | ||
203 | listEntry->setText( itemText ); | 203 | listEntry->setText( itemText ); | ||
204 | listEntry->setData( ToolXmlRole, qVariantFromValue( toolXml ) ); | 204 | listEntry->setData( ToolXmlRole, QVariant::fromValue( toolXml ) ); | ||
205 | listEntry->setData( Qt::DecorationRole, colorDecorationFromToolDescription( toolXml ) ); | 205 | listEntry->setData( Qt::DecorationRole, colorDecorationFromToolDescription( toolXml ) ); | ||
206 | 206 | | |||
207 | // Select and scroll | 207 | // Select and scroll | ||
208 | m_list->setCurrentItem( listEntry ); | 208 | m_list->setCurrentItem( listEntry ); | ||
209 | m_list->scrollToItem( listEntry ); | 209 | m_list->scrollToItem( listEntry ); | ||
210 | updateButtons(); | 210 | updateButtons(); | ||
211 | emit changed(); | 211 | emit changed(); | ||
212 | } | 212 | } |