当前位置:网站首页>Precautions for binding shortcut keys of QPushButton
Precautions for binding shortcut keys of QPushButton
2022-07-06 18:52:00 【HL_ Aeolus】
In a daily development , You need to add a shortcut key operation for the button , Pressing a key on the designated keyboard is equivalent to clicking this button with the mouse , This is the function of shortcut keys
There is a phenomenon that when the order of adding shortcut keys is like this , Invalid shortcut key
First bind the shortcut keys , Then set the button text , Invalid
QKeySequence keyCut(Qt::Key_Return);
btnStart->setShortcut(keyCut);
btnStart->setText(" Start ");
Set the text first , Then bind the shortcut keys , It works
btnStart->setText(" Start ");
QKeySequence keyCut(Qt::Key_Return);
btnStart->setShortcut(keyCut);
Then I try again to comment out the code that sets the text , Then bind the shortcut key , Run the program , Press enter , I rely on , The program crashed
//btnStart->setText(" Start ");
QKeySequence keyCut(Qt::Key_Return);
btnStart->setShortcut(keyCut);
The above is a small detail I found in a daily development , I don't know if it's my version Qt5.7.1 Reasons for too low , At present, I haven't tried the higher version Qt Whether there is the same phenomenon , Welcome to leave a message for discussion !!
边栏推荐
猜你喜欢

Introduction and case analysis of Prophet model

多线程基础:线程基本概念与线程的创建

Binary search tree

Docker安装Redis
![[matlab] Simulink the input and output variables of the same module cannot have the same name](/img/99/adfe50075010916439cd053b8f04c7.png)
[matlab] Simulink the input and output variables of the same module cannot have the same name

When visual studio code starts, it prompts "the code installation seems to be corrupt. Please reinstall." Solution to displaying "unsupported" information in the title bar

44 colleges and universities were selected! Publicity of distributed intelligent computing project list

测试行业的小伙伴,有问题可以找我哈。菜鸟一枚~

Implementation of AVL tree

基于ppg和fft神经网络的光学血压估计【翻译】
随机推荐
A method of sequentially loading Unity Resources
UFIDA OA vulnerability learning - ncfindweb directory traversal vulnerability
Grafana 9.0 is officially released! It's the strongest!
爬虫玩得好,牢饭吃到饱?这3条底线千万不能碰!
First, look at K, an ugly number
DOM Brief
基于ppg和fft神经网络的光学血压估计【翻译】
人体骨骼点检测:自顶向下(部分理论)
Oracle advanced (IV) table connection explanation
Reptiles have a good time. Are you full? These three bottom lines must not be touched!
基于蝴蝶种类识别
Cocos2d Lua smaller and smaller sample memory game
Mathematics in machine learning -- common probability distribution (XIII): Logistic Distribution
Markdown syntax for document editing (typera)
How does crmeb mall system help marketing?
atcoder它A Mountaineer
Bonecp uses data sources
【论文笔记】TransUNet: Transformers Make StrongEncoders for Medical Image Segmentation
Using block to realize the traditional values between two pages
徐翔妻子应莹回应“股评”:自己写的!