diff options
Diffstat (limited to 'kdeui/tests/kpopuptest.cpp')
-rw-r--r-- | kdeui/tests/kpopuptest.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/kdeui/tests/kpopuptest.cpp b/kdeui/tests/kpopuptest.cpp new file mode 100644 index 000000000..43e3c0958 --- /dev/null +++ b/kdeui/tests/kpopuptest.cpp @@ -0,0 +1,40 @@ +#include <kapplication.h> +#include <qwidget.h> +#include <qcursor.h> +#include "kpopupmenu.h" + +class DemoWidget : public QWidget { +private: + KPopupMenu *menu; + +void mousePressEvent(QMouseEvent *) +{ + menu->popup(QCursor::pos()); +} + +void paintEvent(QPaintEvent *) +{ + drawText(32, 32, "Press a Mouse Button!"); +} + +public: + DemoWidget() : QWidget() + { + menu = new KPopupMenu("Popup Menu:"); + menu->insertItem("Item1"); + menu->insertItem("Item2"); + menu->insertSeparator(); + menu->insertItem("Quit", qApp, SLOT(quit())); + } +}; + +int main(int argc, char **argv) +{ + KApplication app(argc, argv, "kpopupmenutest"); + DemoWidget w; + app.setMainWidget(&w); + w.setFont(QFont("helvetica", 12, QFont::Bold), true); + w.show(); + return app.exec(); +} + |