当前位置:网站首页>Add default right-click menu
Add default right-click menu
2022-06-13 01:22:00 【Zhao_| adult】
1. Set default menu
this->setContextMenuPolicy(Qt::ContextMenuPolicy::DefaultContextMenu);
2. Rewrite the virtual function
void contextMenuEvent(QContextMenuEvent *event);
3. Example
// Constructors
//this->setContextMenuPolicy(Qt::ContextMenuPolicy::DefaultContextMenu);
widgetMenu=new QMenu(this);
QAction *actNextofWidgetMenu=new QAction(" next ",widgetMenu);
QAction *actForwardofWidgetMenu=new QAction(" Previous ",widgetMenu);
widgetMenu->addAction(actNextofWidgetMenu);
widgetMenu->addAction(actForwardofWidgetMenu);
connect(actNextofWidgetMenu,&QAction::triggered,this,&Widget::on_actNextofWidgetMenu);
connect(actForwardofWidgetMenu,&QAction::triggered,this,&Widget::on_actForwardofWidgetMenu);
边栏推荐
- Jenkins持续集成操作
- Matrix fast power
- 使用Pygame创建一个简单游戏界面
- How to choose stocks? Which indicator strategy is reliable? Quantitative analysis and comparison of DBCD, ROC, vroc, Cr and psy index strategy income
- Key point detection data preparation and model design based on u-net Network -- detection model of four key points of industrial components
- Simple operation of MySQL database
- ArrayList underlying source code
- Unity calls alertdialog
- Wangdao machine test - Chapter 6 - maximum common divisor GCD and minimum common multiple LCM
- Higherhrnet pre training model -- download from network disk
猜你喜欢
How to choose stocks? Which indicator strategy is reliable? Quantitative analysis and comparison of DBCD, ROC, vroc, Cr and psy index strategy income
Leetcode 01 array
ES6解构赋值
Sonarqube local installation
Rasa对话机器人之HelpDesk (三)
How to choose stocks? Which indicator strategy is reliable? Quantitative analysis and comparison of strategic returns of BBI, MTM, obv, CCI and priceosc indicators
Common skills for quantitative investment - drawing 2: drawing the moving average
Application advantages of 5g industrial gateway in coal industry
Leetcode question brushing 02 linked list operation
Wal mechanism of MySQL
随机推荐
A summary of global variables and typedef
ES6 deconstruction assignment
Polymorphism and virtual function
Thread code learning notes
MySQL transaction
Several categories of software testing are clear at a glance
Unitywebrequest asynchronous Download
Stack and queue practice (C language): Demon King's language
HashSet underlying source code
论文笔记:STMARL: A Spatio-Temporal Multi-AgentReinforcement Learning Approach for Cooperative Traffic
4K sea bottom and water surface fabrication method and ocean bump displacement texture Download
Sliding window summary of TCP connections
Liu Hui and introduction to nine chapter arithmetic and island arithmetic
Leetcode question brushing 07 double pointer
Three paradigms of database
Exercise 5.14 input n strings, arrange them in alphabetical order and output them.
Alexnet implements image classification of caltech101 dataset (pytorch Implementation)
Leetcode-13- Roman numeral to integer (simple)
The second round of mesa
Common skills for quantitative investment - drawing 2: drawing the moving average