qspinbox

Qt find out if QSpinBox was changed by user

[亡魂溺海] 提交于 2020-12-30 07:28:53
问题 Let's suppose I have a QSpinBox , how I can find out if the value was changed manually from user or from a other function? EDIT: I want to do some actions only when user change values but if your program does it (setValue) I don't want do this actions. 回答1: Possible solution: ui->spinBox->blockSignals(true); ui->spinBox->setValue(50); ui->spinBox->blockSignals(false); In this case, signal will not be emitted, so all what you can catch by valueChanged() signal is only user's action. For

Signal click on QSpinBox Qt

拜拜、爱过 提交于 2020-07-07 11:46:54
问题 I would like to open a window when I click on a QSpinBox . The problem is that there is no such signal "clicked" for this widget. Does someone has an idea how to do that? 回答1: A QSpinBox is just a QLineEdit with two buttons, input validation and event handling. It doesn't have clicked signal because it's supposed to handle the mouse even itself. The problem is that even making a custom widget derived from QSpinBox won't be enough since it doesn't receive the mouse events itself, they are

Signal click on QSpinBox Qt

不想你离开。 提交于 2020-07-07 11:46:07
问题 I would like to open a window when I click on a QSpinBox . The problem is that there is no such signal "clicked" for this widget. Does someone has an idea how to do that? 回答1: A QSpinBox is just a QLineEdit with two buttons, input validation and event handling. It doesn't have clicked signal because it's supposed to handle the mouse even itself. The problem is that even making a custom widget derived from QSpinBox won't be enough since it doesn't receive the mouse events itself, they are

Make QSpinBox react to mouse wheel events when cursor is not over it

不想你离开。 提交于 2020-01-06 15:33:35
问题 I am using Qt 5.3.2 with Qt Creator 3.2.1 with MinGW 4.8.2 on Windows 7 . I have a QSpinBox and can change its value with the mouse wheel only if the mouse is over the QSpinBox . If the mouse is not over the QSpinBox , scrolling the mouse wheel has no effect, even though the QSpinBox still has focus. What do I need to do to be able to change values in the QSpinBox that has focus with the mouse wheel even if the mouse is not hovering over it? Setting mouseTracking to true does not have that

QSpinBox enter NaN as a valid value

这一生的挚爱 提交于 2020-01-04 09:12:54
问题 I am trying to extend the QSpinBox to be able to enter "NaN" or "nan" as a valid value. According to the documentation i should use the textFromValue, valueFromText, and validate functions to accomplish this but i cant get it to work since its still not allowing me to enter any text besides numbers. Here is what i have in my .h and .cpp files: CPP file: #include "CustomIntSpinBox.h" CustomIntSpinBox::CustomIntSpinBox(QWidget *parent) : QSpinBox(parent) { this->setRange(-32767,32767); }

QSpinBox enter NaN as a valid value

两盒软妹~` 提交于 2020-01-04 09:12:10
问题 I am trying to extend the QSpinBox to be able to enter "NaN" or "nan" as a valid value. According to the documentation i should use the textFromValue, valueFromText, and validate functions to accomplish this but i cant get it to work since its still not allowing me to enter any text besides numbers. Here is what i have in my .h and .cpp files: CPP file: #include "CustomIntSpinBox.h" CustomIntSpinBox::CustomIntSpinBox(QWidget *parent) : QSpinBox(parent) { this->setRange(-32767,32767); }

How to prevent QSpinBox from automatically highlighting contents

南笙酒味 提交于 2019-12-23 09:33:54
问题 QSpinBox makes its contents selected (highlighted) upon using up/down buttons. Is there any way to disable this? Is there any way to clear selection, other than use my own subclass of QSpinBox to access the underlying QLineEdit ? 回答1: There's no way to directly disable it, but you can do a bit of a hack: void Window::onSpinBoxValueChanged() // slot { spinBox->findChild<QLineEdit*>()->deselect(); } I recommend connecting to this using a queued connection, like this: connect(spinBox, SIGNAL

QSpinBox with Unsigned Int for Hex Input

筅森魡賤 提交于 2019-12-23 08:00:11
问题 There are a variety of questions written here about QSpinBox's limitation of using an int as its datatype. Often people want to display larger numbers. In my case, I want to be able to show an unsigned 32bit integer in hexadecimal. This means I'd like my range to be [0x0, 0xFFFFFFFF]. The largest a normal QSpinBox can go is 0x7FFFFFFF. Answering my own question here, the solution I came up with is to simply force the int to be treated like an unsigned int, by reimplementing the relevant

label displays sum of two QSpinBox (Python + Pyside)?

雨燕双飞 提交于 2019-12-23 05:09:38
问题 Could someone help me fix the code to display in the total column the sum of the two spinners 'Amount + Counter'. Currently the total label just displays the value of a single spinner. I need it to display the sum of both spinners. Any additional fixes or notes are welcome as I'm new to python. Thank you very much. BELOW IS THE FIXED WORKING CODE #!/usr/bin/python # -*- coding: utf-8 -*- import sys from PySide import QtGui, QtCore class Example(QtGui.QWidget): def __init__(self): super

PyQt/PySide QSpinBox flickering issue

蹲街弑〆低调 提交于 2019-12-13 01:26:02
问题 I have added a QSpinBox to a QGraphicsScene using a QGraphicsProxyWidget. Each time I hover over the QSpinBox, it flickers with a black band overlaid on the spinbox controls. I have attached a screenshot and the code below. Am I doing something wrong? Is there a way to avoid this? Pyside 1.1.2, Python 2.7, Windows7. class testWidget(QGraphicsView): def __init__(self): QGraphicsView.__init__(self) floorSpinBox = QSpinBox() floorSpinBox.setGeometry(0,0,50,25) proxyWidget = QGraphicsProxyWidget(