qt


QPushButton is not clicked on the first click


I have Qt 5.6 and I'm using the pressed signal of a button witch then shows a dialog. unfortunately the button of dialog is not clicked in the first time but the second click is working perfectly.
you can test this situation by showing a QMessageBox::information in a on_someButton_pressed slot.
Sorry, can't reproduce: works for me. And you should have written this test case. It's almost less words to code it up than to describe the problem.
#include <QtWidgets>
int main(int argc, char ** argv) {
QApplication app{argc, argv};
QPushButton button{"Press me"};
button.setMinimumSize(300, 150);
button.setFont(QFont{"Helvetica", 20});
QObject::connect(&button, &QPushButton::pressed, [&]{
QMessageBox::information(&button, "Yes!", "You pressed me.");
});
button.show();
app.exec();
}
As an aside, you should be using the clicked() signal, not the pressed() signal. Usability suffers if you use the latter.

Related Links

Share window created in Qt C++ with PyQt
Qt: QLineEdit cursor moves to end after textChanged() or commitData()
How can I extract plain text (no markup) from QWebElement?
How can I paint on a specific pixel in BlackBerry 10, Qt QML Cpp
Size of Qt containers: is QMap much larger than Qlist?
Qt QProcess Complains about QThread::Start , Thread Creation Error
QML Repeater itemAt not working
How to reach a Qt widget from another class
Qt Popup as a completer window
What does (set PATH=…;%PATH:)=^)%) mean in a Windows shell script, and how can I overcome failure of this line in the context of a Qt5 nmake build?
Make a private C++ function visible to Qml
How to clip left side of column cell when resizing a pyqt tableview
Opening a chm file containing merged files in a Qt application
Unable to build Qt 5.0 on Solaris 10
How to get list of visible QModelIndex in QAbstractItemView
Qt: Run a script BEFORE make

Categories

HOME
elasticsearch
visual-studio
magento2
barcode-scanner
long-integer
applescript
postgresql-9.4
android-emulator
bing-search
google-play-services
greasemonkey
dji-sdk
jint
haxe
joomla3.2
onvif
kurento
tup
mailing-list
clickable-image
erd
spring-amqp
google-tasks-api
vertica
cocos2d-android
scala-ide
cloudsim
bsd
qa
sybase-ase
pdf.js
webviewclient
tortoisehg
cube
materialize
region
android-alarms
tidal-scheduler
yoast
elasticsearch-aggregation
audio-converter
qvtkwidget
roracle
android-5.0-lollipop
password-hash
sonicmq
sharpdx
node-apn
sonatype
iptv
subforms
deedle
gapi
s-function
logical
declarative
highlighting
mnesia
seadragon
gdl
outlook.com
boost-proto
cryptojs
ibm-was
enaml
css-paged-media
supercomputers
replicaset
angular-amd
fat32
sunos
nesper
osascript
git-reset
rails-api
meteor-collections
nodeload
flipboard
lync-2010
assetic
principalcontext
libxml-js
ofstream
office-app
linkbutton
arrow
getopt-long
struts2-s2hibernate
affinetransform
servercontrol
delphi-prism
startupscript
page-curl
kernel32
asp.net-mvc-views
airprint
downgrade
ios-4.2
tessellation
activestate
html-components
database-cloning
index.dat
regioninfo

Resources

Encrypt Message