Changeset View
Changeset View
Standalone View
Standalone View
conf/widgetannottools.cpp
Show First 20 Lines • Show All 96 Lines • ▼ Show 20 Line(s) | 89 | { | |||
---|---|---|---|---|---|
97 | QDomElement toolElement = entryParser.documentElement(); | 97 | QDomElement toolElement = entryParser.documentElement(); | ||
98 | if ( toolElement.tagName() == QLatin1String("tool") ) | 98 | if ( toolElement.tagName() == QLatin1String("tool") ) | ||
99 | { | 99 | { | ||
100 | // Create list item and attach the source XML string as data | 100 | // Create list item and attach the source XML string as data | ||
101 | QString itemText = toolElement.attribute( QStringLiteral("name") ); | 101 | QString itemText = toolElement.attribute( QStringLiteral("name") ); | ||
102 | if ( itemText.isEmpty() ) | 102 | if ( itemText.isEmpty() ) | ||
103 | itemText = PageViewAnnotator::defaultToolName( toolElement ); | 103 | itemText = PageViewAnnotator::defaultToolName( toolElement ); | ||
104 | QListWidgetItem * listEntry = new QListWidgetItem( itemText, m_list ); | 104 | QListWidgetItem * listEntry = new QListWidgetItem( itemText, m_list ); | ||
105 | listEntry->setData( ToolXmlRole, qVariantFromValue(toolXml) ); | 105 | listEntry->setData( ToolXmlRole, QVariant::fromValue(toolXml) ); | ||
106 | listEntry->setIcon( PageViewAnnotator::makeToolPixmap( toolElement ) ); | 106 | listEntry->setIcon( PageViewAnnotator::makeToolPixmap( toolElement ) ); | ||
107 | } | 107 | } | ||
108 | } | 108 | } | ||
109 | 109 | | |||
110 | updateButtons(); | 110 | updateButtons(); | ||
111 | } | 111 | } | ||
112 | 112 | | |||
113 | void WidgetAnnotTools::slotEdit() | 113 | void WidgetAnnotTools::slotEdit() | ||
Show All 17 Lines | 114 | { | |||
131 | // Store name attribute only if the user specified a customized name | 131 | // Store name attribute only if the user specified a customized name | ||
132 | if ( !itemText.isEmpty() ) | 132 | if ( !itemText.isEmpty() ) | ||
133 | toolElement.setAttribute( QStringLiteral("name"), itemText ); | 133 | toolElement.setAttribute( QStringLiteral("name"), itemText ); | ||
134 | else | 134 | else | ||
135 | itemText = PageViewAnnotator::defaultToolName( toolElement ); | 135 | itemText = PageViewAnnotator::defaultToolName( toolElement ); | ||
136 | 136 | | |||
137 | // Edit list entry and attach XML string as data | 137 | // Edit list entry and attach XML string as data | ||
138 | listEntry->setText( itemText ); | 138 | listEntry->setText( itemText ); | ||
139 | listEntry->setData( ToolXmlRole, qVariantFromValue( doc.toString(-1) ) ); | 139 | listEntry->setData( ToolXmlRole, QVariant::fromValue( doc.toString(-1) ) ); | ||
140 | listEntry->setIcon( PageViewAnnotator::makeToolPixmap( toolElement ) ); | 140 | listEntry->setIcon( PageViewAnnotator::makeToolPixmap( toolElement ) ); | ||
141 | 141 | | |||
142 | // Select and scroll | 142 | // Select and scroll | ||
143 | m_list->setCurrentItem( listEntry ); | 143 | m_list->setCurrentItem( listEntry ); | ||
144 | m_list->scrollToItem( listEntry ); | 144 | m_list->scrollToItem( listEntry ); | ||
145 | updateButtons(); | 145 | updateButtons(); | ||
146 | emit changed(); | 146 | emit changed(); | ||
147 | } | 147 | } | ||
Show All 13 Lines | 150 | { | |||
161 | // Store name attribute only if the user specified a customized name | 161 | // Store name attribute only if the user specified a customized name | ||
162 | if ( !itemText.isEmpty() ) | 162 | if ( !itemText.isEmpty() ) | ||
163 | toolElement.setAttribute( QStringLiteral("name"), itemText ); | 163 | toolElement.setAttribute( QStringLiteral("name"), itemText ); | ||
164 | else | 164 | else | ||
165 | itemText = PageViewAnnotator::defaultToolName( toolElement ); | 165 | itemText = PageViewAnnotator::defaultToolName( toolElement ); | ||
166 | 166 | | |||
167 | // Create list entry and attach XML string as data | 167 | // Create list entry and attach XML string as data | ||
168 | QListWidgetItem * listEntry = new QListWidgetItem( itemText, m_list ); | 168 | QListWidgetItem * listEntry = new QListWidgetItem( itemText, m_list ); | ||
169 | listEntry->setData( ToolXmlRole, qVariantFromValue( rootDoc.toString(-1) ) ); | 169 | listEntry->setData( ToolXmlRole, QVariant::fromValue( rootDoc.toString(-1) ) ); | ||
170 | listEntry->setIcon( PageViewAnnotator::makeToolPixmap( toolElement ) ); | 170 | listEntry->setIcon( PageViewAnnotator::makeToolPixmap( toolElement ) ); | ||
171 | 171 | | |||
172 | // Select and scroll | 172 | // Select and scroll | ||
173 | m_list->setCurrentItem( listEntry ); | 173 | m_list->setCurrentItem( listEntry ); | ||
174 | m_list->scrollToItem( listEntry ); | 174 | m_list->scrollToItem( listEntry ); | ||
175 | updateButtons(); | 175 | updateButtons(); | ||
176 | emit changed(); | 176 | emit changed(); | ||
177 | } | 177 | } |