Changeset View
Changeset View
Standalone View
Standalone View
src/statusbar/PopupWidget.cpp
Show All 17 Lines | |||||
18 | 18 | | |||
19 | #include "MainWindow.h" | 19 | #include "MainWindow.h" | ||
20 | 20 | | |||
21 | #include "core/support/Debug.h" | 21 | #include "core/support/Debug.h" | ||
22 | 22 | | |||
23 | #include <QVBoxLayout> | 23 | #include <QVBoxLayout> | ||
24 | 24 | | |||
25 | 25 | | |||
26 | PopupWidget::PopupWidget( QWidget *anchor, const QString &name ) | 26 | PopupWidget::PopupWidget( const QString &name ) | ||
27 | : BoxWidget( true, The::mainWindow() ) | 27 | : BoxWidget( true ) | ||
28 | { | 28 | { | ||
29 | Q_UNUSED( name ); | 29 | Q_UNUSED( name ); | ||
30 | Q_UNUSED( anchor ); | | |||
31 | 30 | | |||
32 | setBackgroundRole( QPalette::Window ); | 31 | setBackgroundRole( QPalette::Window ); | ||
33 | setAutoFillBackground( true ); | 32 | setAutoFillBackground( true ); | ||
34 | 33 | | |||
35 | setFrameStyle( QFrame::Box ); | 34 | setFrameStyle( QFrame::Box ); | ||
36 | 35 | | |||
37 | setMinimumWidth( 26 ); | 36 | setMinimumWidth( 26 ); | ||
38 | setMinimumHeight( 26 ); | 37 | setMinimumHeight( 26 ); | ||
39 | 38 | | |||
40 | setContentsMargins( 4, 4, 4, 4 ); | 39 | setContentsMargins( 4, 4, 4, 4 ); | ||
41 | setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); | 40 | setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); | ||
42 | | ||||
43 | reposition(); | | |||
44 | } | 41 | } | ||
45 | 42 | | |||
46 | PopupWidget::~PopupWidget() | 43 | PopupWidget::~PopupWidget() | ||
47 | { | 44 | { | ||
48 | DEBUG_BLOCK | 45 | DEBUG_BLOCK | ||
49 | } | 46 | } | ||
50 | 47 | | |||
51 | void PopupWidget::reposition() | 48 | void PopupWidget::reposition() | ||
52 | { | 49 | { | ||
53 | adjustSize(); | 50 | adjustSize(); | ||
54 | 51 | | |||
52 | if( !The::mainWindow() ) | ||||
53 | return; | ||||
54 | | ||||
55 | //HACK: put longmessage popup in the bottom right of the window. | 55 | //HACK: put longmessage popup in the bottom right of the window. | ||
56 | QPoint p; | 56 | QPoint p; | ||
57 | p.setX( The::mainWindow()->width() - width() ); | 57 | p.setX( The::mainWindow()->width() - width() ); | ||
58 | p.setY( The::mainWindow()->height() - height() ); | 58 | p.setY( The::mainWindow()->height() - height() ); | ||
59 | move( p ); | 59 | move( p ); | ||
60 | } | 60 | } |