Krita Source Code Documentation
Loading...
Searching...
No Matches
KisPopupButtonFrame Class Reference
+ Inheritance diagram for KisPopupButtonFrame:

Public Member Functions

 KisPopupButtonFrame (QWidget *parent, bool detach)
 
void setDetached (bool detach)
 

Protected Member Functions

bool event (QEvent *e) override
 
void keyPressEvent (QKeyEvent *event) override
 

Private Attributes

QHBoxLayout * frameLayout {0}
 

Detailed Description

Definition at line 24 of file KisPopupButton.cpp.

Constructor & Destructor Documentation

◆ KisPopupButtonFrame()

KisPopupButtonFrame::KisPopupButtonFrame ( QWidget * parent,
bool detach )
inline

Definition at line 29 of file KisPopupButton.cpp.

30 : QFrame(parent)
31 {
32 setObjectName("KisPopupButtonFrame");
33 setProperty("_kis_excludeFromLayoutThumbnail", true);
34 frameLayout = new QHBoxLayout(this);
35 frameLayout->setContentsMargins(0, 0, 0, 0);
36
37 setDetached(detach);
38 }
void setDetached(bool detach)
QHBoxLayout * frameLayout

References frameLayout, and setDetached().

Member Function Documentation

◆ event()

bool KisPopupButtonFrame::event ( QEvent * e)
inlineoverrideprotected

Definition at line 77 of file KisPopupButton.cpp.

78 {
79 if (e->type() == QEvent::Close) {
80 e->ignore();
81 hide();
82 return true;
83 }
84 return QFrame::event(e);
85 }

◆ keyPressEvent()

void KisPopupButtonFrame::keyPressEvent ( QKeyEvent * event)
inlineoverrideprotected

Definition at line 67 of file KisPopupButton.cpp.

68 {
69 if (event->matches(QKeySequence::Cancel)) {
70 event->accept();
71 hide();
72 } else {
73 QFrame::keyPressEvent(event);
74 }
75 }
bool event(QEvent *e) override

References event().

◆ setDetached()

void KisPopupButtonFrame::setDetached ( bool detach)
inline

Definition at line 40 of file KisPopupButton.cpp.

41 {
42#if defined Q_OS_ANDROID || defined Q_OS_MACOS
43 // for some reason when calling destroy() the platform window isn't
44 // hidden first, this corrupts state of the window stack
45 hide();
46#endif
47
48 // Need to destroy the platform window before changing window flags
49 // so that Qt knows to actually apply the new flags...
50 // At least on Windows, not doing this may result in weird window drop
51 // shadows.
52 destroy();
53
54 if (detach) {
55 setWindowFlags(Qt::Dialog);
56 setFrameStyle(QFrame::NoFrame);
57 }
58 else {
59 setWindowFlags(Qt::Popup);
60 setFrameStyle(QFrame::Box | QFrame::Plain);
61 }
62
63 updateGeometry();
64 }

Member Data Documentation

◆ frameLayout

QHBoxLayout* KisPopupButtonFrame::frameLayout {0}
private

Definition at line 26 of file KisPopupButton.cpp.

26{0};

The documentation for this class was generated from the following file: