Changeset View
Changeset View
Standalone View
Standalone View
src/kxmlguibuilder.cpp
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 45 | public: | |||
---|---|---|---|---|---|
50 | 50 | | |||
51 | QString tagMainWindow; | 51 | QString tagMainWindow; | ||
52 | QString tagMenuBar; | 52 | QString tagMenuBar; | ||
53 | QString tagMenu; | 53 | QString tagMenu; | ||
54 | QString tagToolBar; | 54 | QString tagToolBar; | ||
55 | QString tagStatusBar; | 55 | QString tagStatusBar; | ||
56 | 56 | | |||
57 | QString tagSeparator; | 57 | QString tagSeparator; | ||
58 | QString tagSpacer; | ||||
58 | QString tagTearOffHandle; | 59 | QString tagTearOffHandle; | ||
59 | QString tagMenuTitle; | 60 | QString tagMenuTitle; | ||
60 | 61 | | |||
61 | QString attrName; | 62 | QString attrName; | ||
62 | QString attrLineSeparator; | 63 | QString attrLineSeparator; | ||
63 | 64 | | |||
64 | QString attrDomain; | 65 | QString attrDomain; | ||
65 | QString attrText1; | 66 | QString attrText1; | ||
Show All 14 Lines | 79 | { | |||
80 | 81 | | |||
81 | d->tagMainWindow = QStringLiteral("mainwindow"); | 82 | d->tagMainWindow = QStringLiteral("mainwindow"); | ||
82 | d->tagMenuBar = QStringLiteral("menubar"); | 83 | d->tagMenuBar = QStringLiteral("menubar"); | ||
83 | d->tagMenu = QStringLiteral("menu"); | 84 | d->tagMenu = QStringLiteral("menu"); | ||
84 | d->tagToolBar = QStringLiteral("toolbar"); | 85 | d->tagToolBar = QStringLiteral("toolbar"); | ||
85 | d->tagStatusBar = QStringLiteral("statusbar"); | 86 | d->tagStatusBar = QStringLiteral("statusbar"); | ||
86 | 87 | | |||
87 | d->tagSeparator = QStringLiteral("separator"); | 88 | d->tagSeparator = QStringLiteral("separator"); | ||
89 | d->tagSpacer = QStringLiteral("spacer"); | ||||
88 | d->tagTearOffHandle = QStringLiteral("tearoffhandle"); | 90 | d->tagTearOffHandle = QStringLiteral("tearoffhandle"); | ||
89 | d->tagMenuTitle = QStringLiteral("title"); | 91 | d->tagMenuTitle = QStringLiteral("title"); | ||
90 | 92 | | |||
91 | d->attrName = QStringLiteral("name"); | 93 | d->attrName = QStringLiteral("name"); | ||
92 | d->attrLineSeparator = QStringLiteral("lineseparator"); | 94 | d->attrLineSeparator = QStringLiteral("lineseparator"); | ||
93 | 95 | | |||
94 | d->attrDomain = QStringLiteral("translationDomain"); | 96 | d->attrDomain = QStringLiteral("translationDomain"); | ||
95 | d->attrText1 = QStringLiteral("text"); | 97 | d->attrText1 = QStringLiteral("text"); | ||
▲ Show 20 Lines • Show All 196 Lines • ▼ Show 20 Line(s) | 267 | { | |||
292 | } else { | 294 | } else { | ||
293 | qCWarning(DEBUG_KXMLGUI) << "Unhandled container to remove : " << container->metaObject()->className(); | 295 | qCWarning(DEBUG_KXMLGUI) << "Unhandled container to remove : " << container->metaObject()->className(); | ||
294 | } | 296 | } | ||
295 | } | 297 | } | ||
296 | 298 | | |||
297 | QStringList KXMLGUIBuilder::customTags() const | 299 | QStringList KXMLGUIBuilder::customTags() const | ||
298 | { | 300 | { | ||
299 | QStringList res; | 301 | QStringList res; | ||
300 | res << d->tagSeparator << d->tagTearOffHandle << d->tagMenuTitle; | 302 | res << d->tagSeparator << d->tagSpacer << d->tagTearOffHandle << d->tagMenuTitle; | ||
301 | return res; | 303 | return res; | ||
302 | } | 304 | } | ||
303 | 305 | | |||
304 | QAction *KXMLGUIBuilder::createCustomElement(QWidget *parent, int index, const QDomElement &element) | 306 | QAction *KXMLGUIBuilder::createCustomElement(QWidget *parent, int index, const QDomElement &element) | ||
305 | { | 307 | { | ||
306 | QAction *before = nullptr; | 308 | QAction *before = nullptr; | ||
307 | if (index > 0 && index < parent->actions().count()) { | 309 | if (index > 0 && index < parent->actions().count()) { | ||
308 | before = parent->actions().at(index); | 310 | before = parent->actions().at(index); | ||
Show All 29 Lines | 324 | } else if (KToolBar *bar = qobject_cast<KToolBar *>(parent)) { | |||
338 | } | 340 | } | ||
339 | 341 | | |||
340 | if ( isLineSep ) | 342 | if ( isLineSep ) | ||
341 | return bar->insertSeparator( index ? bar->actions()[index - 1] : 0L ); | 343 | return bar->insertSeparator( index ? bar->actions()[index - 1] : 0L ); | ||
342 | else*/ | 344 | else*/ | ||
343 | 345 | | |||
344 | return bar->insertSeparator(before); | 346 | return bar->insertSeparator(before); | ||
345 | } | 347 | } | ||
348 | } else if (tagName == d->tagSpacer) { | ||||
349 | if (QToolBar *bar = qobject_cast<QToolBar *>(parent)) { | ||||
dfaure: (pre-existing, in the separator code above) QToolBar would be sufficient, technically, in this… | |||||
350 | // Create the simple spacer widget | ||||
351 | QWidget *spacer = new QWidget(parent); | ||||
352 | spacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); | ||||
353 | return bar->insertWidget(before, spacer); | ||||
354 | } | ||||
346 | } else if (tagName == d->tagTearOffHandle) { | 355 | } else if (tagName == d->tagTearOffHandle) { | ||
347 | static_cast<QMenu *>(parent)->setTearOffEnabled(true); | 356 | static_cast<QMenu *>(parent)->setTearOffEnabled(true); | ||
348 | } else if (tagName == d->tagMenuTitle) { | 357 | } else if (tagName == d->tagMenuTitle) { | ||
349 | if (QMenu *m = qobject_cast<QMenu *>(parent)) { | 358 | if (QMenu *m = qobject_cast<QMenu *>(parent)) { | ||
350 | QString i18nText; | 359 | QString i18nText; | ||
351 | const QString text = element.text(); | 360 | const QString text = element.text(); | ||
352 | 361 | | |||
353 | if (text.isEmpty()) { | 362 | if (text.isEmpty()) { | ||
▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines |
(pre-existing, in the separator code above) QToolBar would be sufficient, technically, in this code.