swift
Loading...
Searching...
No Matches
dockwidget.cpp
1// SPDX-FileCopyrightText: Copyright (C) 2014 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
4#include "gui/dockwidget.h"
5
6#include <QApplication>
7#include <QCloseEvent>
8#include <QFrame>
9#include <QLayout>
10#include <QLayoutItem>
11#include <QMenu>
12#include <QPointer>
13#include <QScopedPointer>
14#include <QScreen>
15#include <QSizePolicy>
16#include <QStatusBar>
17#include <QStyle>
18#include <QTimer>
19#include <QVBoxLayout>
20#include <QVariant>
21#include <QWidget>
22#include <QWidgetAction>
23#include <Qt>
24#include <QtGlobal>
25
27#include "gui/guiapplication.h"
28#include "gui/guiutility.h"
29#include "gui/menus/fontmenus.h"
31#include "misc/icons.h"
32#include "misc/logmessage.h"
33#include "misc/verify.h"
34
35using namespace swift::misc;
36using namespace swift::gui::components;
37using namespace swift::gui::settings;
38using namespace swift::gui::menus;
39
40namespace swift::gui
41{
44 CEnableForFramelessWindow(CEnableForFramelessWindow::WindowTool, false, "framelessDockWidget", this),
45 m_allowStatusBar(allowStatusBar)
46 {
47 // init settings
49 this->initTitleBarWidgets();
50 m_originalAreas = this->allowedAreas();
51
52 // context menu
53 m_input = new CMarginsInput(this);
54 m_input->setMaximumWidth(150);
55 m_marginMenuAction = new QWidgetAction(this);
56 m_marginMenuAction->setDefaultWidget(m_input);
57 m_fontMenu = new CFontMenu(this, Qt::WidgetWithChildrenShortcut);
58
60 connect(this, &CDockWidget::customContextMenuRequested, this, &CDockWidget::showContextMenu,
63 &CDockWidget::menuChangeMargins); // only works direct, as QMargins is not registered: 'QMargins' is
64 // registered using qRegisterMetaTyp
65
66 // connect
69 connect(this, &QDockWidget::topLevelChanged, this, &CDockWidget::onTopLevelChanged, Qt::QueuedConnection);
70 connect(this, &QDockWidget::visibilityChanged, this, &CDockWidget::onVisibilityChanged, Qt::QueuedConnection);
73 }
74
76 {
77 if (this->isFloating())
78 {
81 }
82 else
83 {
85 }
86 }
87
89
91 {
92 if (!m_titleBarWidgetOriginal)
93 {
94 this->initTitleBarWidgets();
95 }
96 if (this->titleBarWidget() == m_titleBarWidgetOriginal)
97 {
98 return;
99 } // on purpose, as I do not know what happens when I call setTitleBar
100 this->setTitleBarWidget(m_titleBarWidgetOriginal);
101 }
102
104 {
105 if (!m_titleBarWidgetOriginal)
106 {
107 this->initTitleBarWidgets();
108 }
109 if (this->titleBarWidget() == m_titleBarWidgetEmpty)
110 {
111 return;
112 } // on purpose, as I do not know what happens when I call setTitleBar
113 this->setTitleBarWidget(m_titleBarWidgetEmpty);
114 }
115
117
119 {
120 CDockWidgetSettings s = this->getSettings();
121 s.setMarginsWhenFloating(margins);
122 this->saveSettings(s);
123 }
124
125 void CDockWidget::setMarginsWhenFloating(int left, int top, int right, int bottom)
126 {
127 this->setMarginsWhenFloating(QMargins(left, top, right, bottom));
128 }
129
130 QMargins CDockWidget::getMarginsWhenFloating() const { return this->getSettings().getMarginsWhenFloating(); }
131
133 {
134 CDockWidgetSettings s = this->getSettings();
136 this->saveSettings(s);
137 }
138
139 void CDockWidget::setMarginsWhenFramelessFloating(int left, int top, int right, int bottom)
140 {
141 this->setMarginsWhenFramelessFloating(QMargins(left, top, right, bottom));
142 }
143
145 {
146 return this->getSettings().getMarginsWhenFramelessFloating();
147 }
148
150 {
151 CDockWidgetSettings s = this->getSettings();
152 s.setMarginsWhenDocked(margins);
153 this->saveSettings(s);
154 }
155
156 void CDockWidget::setMarginsWhenDocked(int left, int top, int right, int bottom)
157 {
158 this->setMarginsWhenDocked(QMargins(left, top, right, bottom));
159 }
160
161 QMargins CDockWidget::getMarginsWhenDocked() const { return this->getSettings().getMarginsWhenDocked(); }
162
163 bool CDockWidget::isWidgetVisible() const { return m_dockWidgetVisible && this->isVisible(); }
164
166 {
167 m_windowTitleBackup = title;
169 }
170
172 {
173 if (!m_allowStatusBar || !this->isFloating())
174 {
175 return;
176 }
177 m_statusBar.displayStatusMessage(statusMessage);
178 }
179
181 {
182 if (!m_allowStatusBar || !this->isFloating())
183 {
184 return;
185 }
186 m_statusBar.displayStatusMessages(statusMessages);
187 }
188
190 {
191 m_windowTitleWhenDocked = show;
192 if (show)
193 {
194 QDockWidget::setWindowTitle(m_windowTitleBackup);
195 }
196 else
197 {
199 }
200 }
201
202 void CDockWidget::resetWasAlreadyFloating() { m_wasAlreadyFloating = false; }
203
204 void CDockWidget::setPreferredSizeWhenFloating(const QSize &size) { m_preferredSizeWhenFloating = size; }
205
206 void CDockWidget::setOffsetWhenFloating(const QPoint &point, bool frameless)
207 {
208 Q_UNUSED(frameless)
209 m_offsetWhenFloating = point;
210 }
211
212 void CDockWidget::setFrameless(bool frameless)
213 {
215
216 // grip
217 bool hasStatusBar = m_statusBar.getStatusBar();
218 if (frameless)
219 {
220 if (hasStatusBar)
221 {
222 this->addFramelessSizeGripToStatusBar(m_statusBar.getStatusBar());
223 }
224 }
225 else
226 {
227 if (hasStatusBar)
228 {
230 }
231 }
232
233 // resize
234 if (frameless)
235 {
236 QWidget *innerWidget = this->widget(); // the inner widget containing the layout
237 Q_ASSERT(innerWidget);
238 this->resize(innerWidget->size());
239 }
240
241 this->setMargins();
242 this->forceStyleSheetUpdate(); // force style sheet reload
243 }
244
246 {
247 static const QString s("outerwidget");
248 return s;
249 }
250
252 {
253 static const QString s("innerwidget");
254 return s;
255 }
256
258 {
259 const bool changeToFloating = !this->isFloating();
260 if (!changeToFloating)
261 {
262 this->setFrameless(false);
263 } // remove frameless if not floating
264
265 // disable the interactive docking
266 if (changeToFloating)
267 {
268 m_originalAreas = this->allowedAreas();
270 }
271 else
272 {
273 this->setAllowedAreas(m_originalAreas);
274 }
275
276 this->setAlwaysOnTop(m_alwaysOnTop && changeToFloating);
277 this->setFloating(changeToFloating);
278
280 const bool shift = km.testFlag(Qt::ShiftModifier);
281
282 // with shift ALWAYS reset
283 if (shift && changeToFloating)
284 {
285 this->resetPosition();
286 }
287 if (changeToFloating)
288 {
289 // check where we are, otherwise reset if NOT appropriate
290 const QPoint p = this->rect().topLeft();
291 if (p.x() < 1 || p.y() < 1)
292 {
293 this->resetPosition();
294 }
295 }
296 }
297
299
301 {
302 const bool frameless = this->isFrameless();
303 this->setFrameless(!frameless);
304 }
305
316
318 {
319 if (this->isFloating())
320 {
321 this->setAlwaysOnTopFlag(true);
322 m_alwaysOnTop = true;
323 }
324 }
325
327 {
328 if (this->isFloating())
329 {
330 this->setAlwaysOnTopFlag(false);
331 m_alwaysOnTop = false;
332 }
333 }
334
336 {
337 if (onTop)
338 {
340 }
341 else
342 {
344 }
345 }
346
348 {
349 const CDockWidgetSettings s = this->getSettings();
350 if (s.isFloating() != this->isFloating())
351 {
352 this->toggleFloating();
353 QPointer<CDockWidget> myself(this);
354 QTimer::singleShot(500, this, [=] {
355 if (myself)
356 {
357 myself->restoreFromSettings();
358 }
359 });
360 return true;
361 }
362
363 if (s.isFramless() != this->isFrameless())
364 {
365 this->toggleFrameless();
366 QPointer<CDockWidget> myself(this);
367 QTimer::singleShot(500, this, [=] {
368 if (myself)
369 {
370 myself->restoreFromSettings();
371 }
372 });
373 return true;
374 }
375
376 // now frameless and floating is correct
377 const QByteArray geo(s.getGeometry());
378 if (!geo.isEmpty())
379 {
380 const bool ok = this->restoreGeometry(geo);
381 if (ok)
382 {
383 this->rememberFloatingSizeAndPosition();
384 }
385 }
386
387 this->setMargins();
388 return true;
389 }
390
392 {
393 if (this->isFloating())
394 {
395 this->toggleFloating();
396
408
409 event->setAccepted(false); // refuse -> do not close (otherwise crash)
410 }
411 else
412 {
414 }
415 }
416
423
431
433 {
434 if (event->key() == Qt::Key_Escape && this->isFloating())
435 {
436 this->toggleFloating();
437 }
439 }
440
448
449 void CDockWidget::addToContextMenu(QMenu *contextMenu) const
450 {
451 if (this->isFloating())
452 {
453 const bool frameless = this->isFrameless();
454
455 contextMenu->addAction(CIcons::dockTop16(), "Dock", this, &CDockWidget::toggleFloating);
456 contextMenu->addAction(CIcons::tableSheet16(), frameless ? "Normal window" : "Frameless", this,
458 contextMenu->addAction(CIcons::dockTop16(), "Always on top", this, &CDockWidget::windowAlwaysOnTop);
459 contextMenu->addAction(CIcons::dockTop16(), "Not on top", this, &CDockWidget::windowNotAlwaysOnTop);
460 contextMenu->addAction(CIcons::refresh16(), "Redraw", this, qOverload<>(&CDockWidget::update));
461 }
462 else
463 {
464 contextMenu->addAction(CIcons::floatOne16(), "Float", this, &CDockWidget::toggleFloating);
465 }
466
467 // Font actions
468 Q_ASSERT_X(m_fontMenu, Q_FUNC_INFO, "Missing menu object");
469 if (m_fontMenu)
470 {
471 contextMenu->addActions(m_fontMenu->getActions());
472 }
473
474 // State actions (windows state)
475 contextMenu->addAction(CIcons::load16(), "Restore from settings", this, &CDockWidget::restoreFromSettings);
476 contextMenu->addAction(CIcons::save16(), "Save state", this, &CDockWidget::saveCurrentStateToSettings);
477 contextMenu->addAction(CIcons::refresh16(), "Reset to defaults", this, &CDockWidget::resetSettings);
478 contextMenu->addAction(CIcons::refresh16(), "Reset position", this, &CDockWidget::resetPosition);
479
480 m_input->setMargins(this->contentsMargins());
481 contextMenu->addAction(CIcons::tableSheet16(), "Margins", this, &CDockWidget::dummy);
482 contextMenu->addAction(m_marginMenuAction);
483 }
484
486 {
487 // init status bar, as we have now all structures set and name is known
488 this->initStatusBarAndProperties();
489
490 // for the first time resize
491 SWIFT_VERIFY(!m_preferredSizeWhenFloating.isNull());
492 if (!m_preferredSizeWhenFloating.isNull())
493 {
494 m_initialDockedMinimumSize = this->minimumSize();
495 this->resize(m_preferredSizeWhenFloating);
496 }
497
498 // and move
499 this->resetPosition();
500
501 // deferred int from settings
502 this->restoreFloatingSizeAndPositionDeferred();
503 }
504
506 {
507 const QString t(windowTitle());
508 if (t.isEmpty())
509 {
510 return this->windowTitleBackup();
511 }
512 return t;
513 }
514
515 void CDockWidget::onTopLevelChanged(bool topLevel)
516 {
517#ifdef Q_OS_LINUX
518 // Give XCB platforms enough time to handle window events before adjusting it.
519 // close T593 if this is no longer needed
520 QThread::msleep(100);
521#endif
522
523 this->setMargins(); // from settings or default
524 if (topLevel)
525 {
526 if (m_windowTitleBackup != QDockWidget::windowTitle())
527 {
528 QDockWidget::setWindowTitle(m_windowTitleBackup);
529 }
530 this->setNullTitleBarWidget();
531 if (m_wasFrameless)
532 {
533 this->setFrameless(true);
534 }
535
547
548 m_statusBar.show();
549 m_wasAlreadyFloating = true;
550 }
551 else
552 {
553 // frameless
554 this->setFrameless(false);
555
556 if (!m_windowTitleWhenDocked)
557 {
559 }
560 m_statusBar.hide();
561 this->setEmptyTitleBar();
562
563 // sometimes floating sets a new minimum size, here we reset it
564 if (this->minimumHeight() > m_initialDockedMinimumSize.height())
565 {
566 this->setMinimumSize(m_initialDockedMinimumSize);
567 }
568 }
569
570 // relay
571 emit this->widgetTopLevelChanged(this, topLevel);
572 }
573
574 void CDockWidget::initTitleBarWidgets()
575 {
576 m_titleBarWidgetOriginal = this->titleBarWidget();
577 m_titleBarWidgetEmpty = new QWidget(this);
578 this->setTitleBarWidget(m_titleBarWidgetEmpty);
579 }
580
581 void CDockWidget::initStatusBarAndProperties()
582 {
583 if (m_statusBar.getStatusBar())
584 {
585 return;
586 }
587
588 // Typical reasons for asserts here
589 // 1) Check the structure, we expect the following hierarchy:
590 // QDockWidget (CDockWidget/CDockWidgetInfoArea) -> QWidget (outer widget) -> QFrame (inner widget)
591 // Structure used for frameless floating windows
592 // 2) Check if the "floating" flag is accidentally set for the dock widget in the GUI builder
593 // 3) Is the dock widget promoted swift::gui::CDockWidgetInfoArea?
594 QWidget *outerWidget = this->widget(); // the outer widget containing the layout
595 Q_ASSERT_X(outerWidget, "CDockWidget::initStatusBar", "No outer widget");
596 if (!outerWidget)
597 {
598 return;
599 }
600 outerWidget->setProperty("dockwidget", propertyOuterWidget());
601
602 Q_ASSERT_X(outerWidget->layout(), "CDockWidget::initStatusBar", "No outer widget layout");
603 if (!outerWidget->layout())
604 {
605 return;
606 }
607 Q_ASSERT_X(outerWidget->layout()->itemAt(0) && outerWidget->layout()->itemAt(0)->widget(),
608 "CDockWidget::initStatusBar", "No outer widget layout item");
609 if (!outerWidget->layout()->itemAt(0) || !outerWidget->layout()->itemAt(0)->widget())
610 {
611 m_allowStatusBar = false;
612 return;
613 }
614
615 // Inner widget is supposed to be a QFrame / promoted QFrame
616 auto *innerWidget = qobject_cast<QFrame *>(
617 outerWidget->layout()->itemAt(0)->widget()); // the inner widget containing the layout
618 Q_ASSERT_X(innerWidget, "CDockWidget::initStatusBar", "No inner widget");
619 if (!innerWidget)
620 {
621 m_allowStatusBar = false;
622 return;
623 }
624 innerWidget->setProperty("dockwidget", propertyInnerWidget());
625
626 // status bar
627 if (!m_allowStatusBar)
628 {
629 return;
630 }
631 m_statusBar.initStatusBar();
632
633 // layout
634 auto *vLayout = qobject_cast<QVBoxLayout *>(innerWidget->layout());
635 Q_ASSERT_X(vLayout, "CDockWidget::initStatusBar", "No outer widget layout");
636 if (!vLayout)
637 {
638 m_allowStatusBar = false;
639 return;
640 }
641 vLayout->addWidget(m_statusBar.getStatusBar(), 0, Qt::AlignBottom); // 0->vertical stretch minimum
642
643 // adjust stretching of the original widget. It was the only widget so far
644 // and should occupy maximum space
645 auto *compWidget = innerWidget->findChild<QWidget *>(QString(), Qt::FindDirectChildrenOnly);
646 Q_ASSERT(compWidget);
647 if (!compWidget)
648 {
649 return;
650 }
651 QSizePolicy sizePolicy = compWidget->sizePolicy();
652 sizePolicy.setVerticalStretch(1); // make the original widget occupying maximum space
653 compWidget->setSizePolicy(sizePolicy);
654
655 // hide status bar if not floating T592 no longer init floating
656 if (!this->isFloating())
657 {
658 m_statusBar.hide();
659 }
660 }
661
662 void CDockWidget::showContextMenu(const QPoint &pos)
663 {
664 const QPoint globalPos = this->mapToGlobal(pos);
665 QScopedPointer<QMenu> contextMenu(new QMenu(this));
666 this->addToContextMenu(contextMenu.data());
667 QAction *selectedItem = contextMenu.data()->exec(globalPos);
668 Q_UNUSED(selectedItem)
669 }
670
671 void CDockWidget::onVisibilityChanged(bool visible) { m_dockWidgetVisible = visible; }
672
673 void CDockWidget::menuChangeMargins(const QMargins &margins)
674 {
675 const bool frameless = this->isFrameless();
676 const bool floating = this->isFloating();
677 if (floating)
678 {
679 if (frameless)
680 {
681 this->setMarginsWhenFramelessFloating(margins);
682 }
683 else
684 {
685 this->setMarginsWhenFloating(margins);
686 }
687 }
688 else
689 {
690 this->setMarginsWhenDocked(margins);
691 }
692 this->setContentsMargins(margins);
693 this->repaint();
694 }
695
696 void CDockWidget::settingsChanged()
697 {
698 // void, normally not used
699 }
700
701 void CDockWidget::dummy()
702 {
703 // void
704 }
705
707 {
708 // style sheet changes go here
709 }
710
711 void CDockWidget::forceStyleSheetUpdate()
712 {
713 const QString qss = this->styleSheet();
714 this->setStyleSheet(qss.isEmpty() ? QStringLiteral(" ") : QString());
715 this->setStyleSheet(qss);
716 }
717
718 void CDockWidget::rememberFloatingSizeAndPosition()
719 {
720 if (!this->isFloating())
721 {
722 return;
723 }
724 m_lastFloatingSize = this->size();
725 m_lastFloatingPosition = this->pos();
726 }
727
728 void CDockWidget::restoreFloatingSizeAndPosition()
729 {
730 if (!m_lastFloatingSize.isValid() || m_lastFloatingPosition.isNull())
731 {
732 return;
733 }
734 this->resize(m_lastFloatingSize);
735 this->move(m_lastFloatingPosition);
736 }
737
738 void CDockWidget::restoreFloatingSizeAndPositionDeferred()
739 {
740 // if (!m_lastFloatingSize.isValid() || m_lastFloatingPosition.isNull()) { return; }
741 QPointer<CDockWidget> myself(this);
742 QTimer::singleShot(2500, this, [=] {
743 if (!myself)
744 {
745 return;
746 }
748 const bool shift = km.testFlag(Qt::ShiftModifier);
749 if (shift)
750 {
751 return;
752 }
753
755 {
756 return;
757 }
758 myself->restoreFromSettings();
759 });
760 }
761
762 CDockWidgetSettings CDockWidget::getSettings() const
763 {
764 if (this->objectName().isEmpty())
765 {
766 return {};
767 }
768
769 // we need object name for settings %OwnerName%"
770 const CDockWidgetSettings s = m_settings.get();
771 return s;
772 }
773
774 void CDockWidget::saveSettings(const CDockWidgetSettings &settings)
775 {
776 SWIFT_VERIFY_X(!this->objectName().isEmpty(), Q_FUNC_INFO, "Need object name for settings %OwnerName%");
777 if (this->objectName().isEmpty())
778 {
779 CStatusMessage(this).error(u"Settings cannot be saved!");
780 return;
781 }
782
783 const CStatusMessage m = m_settings.setAndSave(settings);
784 if (m.isFailure())
785 {
787 }
788 }
789
791 {
792 CDockWidgetSettings s = this->getSettings();
793 const bool floating = this->isFloating();
794 const bool frameless = this->isFrameless();
795 const QByteArray geo = this->saveGeometry();
797 s.setFrameless(frameless);
798 s.setGeometry(geo);
799 this->saveSettings(s);
800 }
801
803 {
804 CDockWidgetSettings s = this->getSettings();
805 s.reset();
806 this->saveSettings(s);
807 this->restoreFromSettings();
808 }
809
811 {
812 // center on screen when floating
813 if (!this->isFloating())
814 {
815 return;
816 }
817 if (!sGui)
818 {
819 return;
820 }
821
822 // pos can be null during init
825 if (pos.isNull())
826 {
827 pos = CGuiApplication::currentScreen()->geometry().center() - this->rect().center();
828 }
829
830 const int osFloatingX = m_offsetWhenFloating.x();
831 const int osFloatingY = m_offsetWhenFloating.y();
832 const int x = pos.x() + osFloatingX;
833 const int y = pos.y() + osFloatingY;
834 this->move(x, y);
835 }
836} // namespace swift::gui
void toggleVisibility()
Toggle visibility.
void closeEvent(QCloseEvent *event)
QString windowTitleOrBackup() const
If current window title is empty, use backup.
CDockWidget(QWidget *parent=nullptr)
Constructor.
void setAlwaysOnTop(bool onTop)
Set always on top.
Definition dockwidget.h:121
void setWindowTitle(const QString &title)
Set title and internally keep a backup.
virtual void addToContextMenu(QMenu *contextMenu) const
Contribute to menu.
void windowNotAlwaysOnTop()
Window not on top.
void widgetTopLevelChanged(CDockWidget *, bool topLevel)
Top level has changed for given widget.
void mousePressEvent(QMouseEvent *event)
void allowStatusBar(bool allow)
Allow a status bar to be displayed.
Definition dockwidget.h:82
void setMarginsWhenFramelessFloating(const QMargins &margins)
Margins when window is floating (frameless).
void setPreferredSizeWhenFloating(const QSize &size)
Size when floating first time.
void setAlwaysOnTopFlag(bool onTop)
Set the on top flag.
void windowAlwaysOnTop()
Toggle frameless deferred.
void resetSettings()
Reset margin settings.
virtual void onStyleSheetsChanged()
Style sheet has changed.
bool restoreFromSettings()
Restore from settings.
void paintEvent(QPaintEvent *event)
void setNullTitleBarWidget()
Set null (nullptr) title bar.
QMargins getMarginsWhenDocked() const
Margins when docked.
void setFrameless(bool frameless)
Framless.
void setOriginalTitleBar()
Set original title bar.
QMargins getMarginsWhenFramelessFloating() const
Margins when floating and frameless.
void fontSizeMinus()
Font size signals.
static const QString & propertyOuterWidget()
Value for dynamic property "dockwidget".
bool isWidgetVisible() const
Is widget visible? Not to be confused with.
void saveCurrentStateToSettings()
Remember widget state.
void setMargins()
Set margins from settings.
void mouseMoveEvent(QMouseEvent *event)
void toggleFloating()
Toggle floating.
void setEmptyTitleBar()
Set empty title bar (empty widget as title bar).
void resetPosition()
Reset window position.
void displayStatusMessages(const swift::misc::CStatusMessageList &statusMessages)
Display status messages.
void toggleFrameless()
Toggle frameless mode.
void resetWasAlreadyFloating()
Reset first time floating, marked as never floated before.
void fontSizePlus()
Font size signals.
void displayStatusMessage(const swift::misc::CStatusMessage &statusMessage)
Display status message.
void setMarginsWhenDocked(const QMargins &margins)
Margins when widget is floating.
void setOffsetWhenFloating(const QPoint &point, bool frameless)
Position offset when floating first time.
const QString & windowTitleBackup() const
Window title backup.
Definition dockwidget.h:66
static const QString & propertyInnerWidget()
Value for dynamic property "dockwidget".
QMargins getMarginsWhenFloating() const
Margins when floating.
void keyPressEvent(QKeyEvent *event)
void setMarginsWhenFloating(const QMargins &margins)
Margins when window is floating.
bool showTitleWhenDocked() const
Window title when window is docked.
Definition dockwidget.h:72
virtual void initialFloating()
Widget is initialized by being a floating window for a shot period.
bool handleMousePressEvent(QMouseEvent *event)
Mouse press, required for frameless window.
void addFramelessSizeGripToStatusBar(QStatusBar *statusBar)
Resize grip handle.
void hideFramelessSizeGripInStatusBar()
Resize grip handle.
virtual void setFrameless(bool frameless)
Framless.
bool handleMouseMoveEvent(QMouseEvent *event)
Mouse moving, required for frameless window.
CEnableForFramelessWindow(WindowMode mode, bool isMainApplicationWindow, const char *framelessPropertyname, QWidget *correspondingWidget)
Constructor.
bool isCmdWindowSizeResetSet() const
Window size reset mode set.
static QScreen * currentScreen()
Current screen.
void styleSheetsChanged()
Style sheet changed.
static QPoint mainWidgetGlobalPosition()
Position of main widget.
static QWidget * mainApplicationWidget()
Main application window widget.
COverlayMessagesDockWidget(QWidget *parent=nullptr)
Constructor.
static bool useStyleSheetInDerivedWidget(QWidget *derivedWidget, QStyle::PrimitiveElement element=QStyle::PE_Widget)
Use style sheets in derived widgets.
Widget alows to enter margins.
void changedMargins(const QMargins &margins)
Margins changed.
Standard font (size, style) menus. Can be used as nested menu or via getActions added manually.
Definition fontmenus.h:21
void fontSizePlus()
Font size signals.
void fontSizeMinus()
Font size signals.
void setFrameless(bool frameless)
Frameless.
void setMarginsWhenFloating(const QMargins &margins)
Set margins for given dock widget.
void setMarginsWhenFramelessFloating(const QMargins &margins)
Set margins for given dock widget.
void setGeometry(const QByteArray &ba)
Set geometry.
void setMarginsWhenDocked(const QMargins &margins)
Set margins for given dock widget.
static const QPixmap & refresh16()
Refresh.
static const QPixmap & floatOne16()
Float all.
static const QPixmap & dockTop16()
Docking.
static const QPixmap & save16()
Save.
static const QPixmap & load16()
Load.
static const QPixmap & tableSheet16()
Table sheet.
static void preformatted(const CStatusMessage &statusMessage)
Sends a verbatim, preformatted message to the log.
Streamable status message, e.g.
bool isFailure() const
Operation considered unsuccessful.
Status messages, e.g. from Core -> GUI.
SWIFT_GUI_EXPORT swift::gui::CGuiApplication * sGui
Single instance of GUI application object.
High level reusable GUI components.
GUI related classes.
Free functions in swift::misc.
virtual void closeEvent(QCloseEvent *event) override
virtual bool event(QEvent *event) override
bool isFloating() const const
virtual void paintEvent(QPaintEvent *event) override
void setTitleBarWidget(QWidget *widget)
QWidget * titleBarWidget() const const
void topLevelChanged(bool topLevel)
void visibilityChanged(bool visible)
QWidget * widget() const const
Qt::KeyboardModifiers queryKeyboardModifiers()
virtual QLayoutItem * itemAt(int index) const const=0
virtual QWidget * widget() const const
QAction * addAction(const QIcon &icon, const QString &text, Functor functor, const QKeySequence &shortcut)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QObject * parent() const const
T qobject_cast(QObject *object)
bool setProperty(const char *name, QVariant &&value)
int x() const const
int y() const const
bool isEmpty() const const
PE_FrameDockWidget
AlignBottom
QueuedConnection
CustomContextMenu
NoDockWidgetArea
FindDirectChildrenOnly
Key_Escape
typedef KeyboardModifiers
WidgetWithChildrenShortcut
WindowStaysOnTopHint
void msleep(unsigned long msecs)
QWidget(QWidget *parent, Qt::WindowFlags f)
void addActions(const QList< QAction * > &actions)
QMargins contentsMargins() const const
void setContextMenuPolicy(Qt::ContextMenuPolicy policy)
void customContextMenuRequested(const QPoint &pos)
virtual void keyPressEvent(QKeyEvent *event)
QLayout * layout() const const
QPoint mapToGlobal(const QPoint &pos) const const
virtual void mouseMoveEvent(QMouseEvent *event)
virtual void mousePressEvent(QMouseEvent *event)
void repaint()
bool restoreGeometry(const QByteArray &geometry)
QByteArray saveGeometry() const const
void setContentsMargins(const QMargins &margins)
void show()
void update()
bool isVisible() const const
void setWindowFlags(Qt::WindowFlags type)
void setWindowTitle(const QString &)
#define SWIFT_VERIFY_X(COND, WHERE, WHAT)
A weaker kind of assert.
Definition verify.h:26
#define SWIFT_VERIFY(COND)
A weaker kind of assert.
Definition verify.h:29