event_filter.cpp
来自「This a framework to test new ideas in tr」· C++ 代码 · 共 49 行
CPP
49 行
//-----------------------------------------------------------------// A demo program showing how to use event filtering//-----------------------------------------------------------------#include <qapplication.h>#include <qmainwindow.h>#include <qwhatsthis.h>#include <qtoolbar.h>#include "plot.h"#include "canvaspicker.h"#include "scalepicker.h"int main (int argc, char **argv){ QApplication a(argc, argv); QMainWindow mainWindow; QToolBar *toolBar = new QToolBar(&mainWindow); (void)QWhatsThis::whatsThisButton(toolBar); Plot *plot = new Plot(&mainWindow); // The canvas picker handles all mouse and key // events on the plot canvas (void) new CanvasPicker(plot); // The scale picker translates mouse clicks // int o clicked() signals ScalePicker *scalePicker = new ScalePicker(plot); a.connect(scalePicker, SIGNAL(clicked(int, double)), plot, SLOT(insertCurve(int, double))); mainWindow.setCentralWidget(plot); a.setMainWidget(&mainWindow); mainWindow.resize(540, 400); mainWindow.show(); QWhatsThis::add(plot, "An useless plot to demonstrate how to use event filtering.\n\n" "You can click on the color bar, the scales or move the slider.\n" "All points can be moved using the mouse or the keyboard."); int rv = a.exec(); return rv;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?