Questions tagged [qabstractbutton]

The QAbstractButton class, part of the Qt framework, is the abstract base class of button widgets, providing functionality common to buttons.

QAbstractButton is a Qt framework class which implements an abstract button. Subclasses of the class handle user actions, and specify how the button is drawn.

17 questions
6
votes
1 answer

Painting custom QWidget based on style sheet pseudo-state value

I have a custom QWidget (actually, derived from QAbstractButton) for which I have to implement my own paintEvent. How to I use the style sheet information? For example, suppose someone defines the following stylesheet that applies (directly or via…
Dave Mateer
  • 17,608
  • 15
  • 96
  • 149
2
votes
0 answers

Signal/slot not working just in a few objects

I want to connect the clicked signal of some abstract buttons to a same slot. The thing is that it only works on one abstract button, when clicking on the others nothing occurs. Any ideas of what is failing? I have already checked that the…
marpe
  • 185
  • 2
  • 9
2
votes
2 answers

How to Set and Get "comment" text using setText?

I am trying to store string data within a QAbstractButton.text(). Why? I want to display the short name in the text() itself, but be able to call the long name via the text() "comment" through code. You are able to write "comments" within QT…
Adam Sirrelle
  • 357
  • 8
  • 18
2
votes
1 answer

Problems aligning buttons in widget in pyqt5

I've been trying to create a widget with image background and two buttons (cancel and ok) with image and push down/up effect, using pyqt5 GUI of python language, but I have two problem: 1 – I can't align the buttons in widget center 2 – The buttons…
Roger
  • 67
  • 7
2
votes
1 answer

Creating Custom PyQt5 image-button

I'm trying to create a custom PyQt5 button, but am running across problems displaying it in a QMainWindow object. Here's the code I'm trying: import sys from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.QtCore import * from…
Astrum
  • 591
  • 3
  • 12
  • 25
2
votes
1 answer

[Qt]paintEvent not getting called in custom button derived from QAbstractButton

I'm trying to create a custom button, derived from "QAbstractbutton". I have overridden the paintEvent. However, my button is not visible in my widget. What I see is that the paintEvent is not getting called even after calling update/repaint/show on…
mots_g
  • 637
  • 8
  • 27
2
votes
1 answer

What is the purpose of the QAbstractButton::checkStateSet() method?

I'm writing my own 4 state button and I'm not quite sure what to put in the checkStateSet() method, if anything. Here is what I've got so far: SyncDirectionButton::SyncDirectionButton(QWidget *parent) : QAbstractButton(parent) { …
darkadept
  • 647
  • 2
  • 9
  • 23
1
vote
1 answer

problem with SIGNAL SLOT new notation for QAbstractButton

I am writing a small utility composed by : 1) 4 QToolBar 2) 1 QToolBox 3) 1 QMenu 4) 1 QGraphicsView I have some buttons on the QToolBox, each button represents a grid with different spacing. Everytime a user clicks a button on the QToolBox the…
Emanuele
  • 2,194
  • 6
  • 32
  • 71
1
vote
1 answer

Qt QAbstractButton setDown interferes with grabMouse

I have some weird behaviour in Qt that seems like a defect. I'd like to know if anybody has a good workaround. I have a popup widget that contains many buttons in it. The user activates the popup by pressing the mouse button down. The popup widget…
edA-qa mort-ora-y
  • 30,295
  • 39
  • 137
  • 267
1
vote
2 answers

Paint device returned engine == 0, type: 1

I have seen many answers for the same Question, I have already gone through them but none them solved my problem, I am getting the error QWidget::paintEngine: Should no longer be called QPainter::begin: Paint device returned engine == 0, type:…
Akhil V Suku
  • 870
  • 2
  • 13
  • 34
1
vote
1 answer

Two shortcuts for a QAbstractButton

I need to assign two shortcuts to a QAbstractButton, but I cannot find a way to do that. It seems the only method is QAbstractButton::setShortcut(const QKeySequence & key). Is it possible ?
Jérôme
  • 26,567
  • 29
  • 98
  • 120
0
votes
1 answer

How to detect Qt mouse events only over QPainted objects

I am attempting to produce a compass widget programatically that looks much like this: I want each "slice" of the compass to act as a button for interaction w/ the rest of the app. To that end, I figured making them out of QAbstractButtons made the…
Connor Spangler
  • 805
  • 2
  • 12
  • 29
0
votes
1 answer

'void QAbstractButton::clicked(bool)' is protected

I'm actually working on a project with Qt 5.10.1. I'm using Linux and my partners are using Windows. We've written this piece of code: QCheckBox* _survive[9] = { ui->survive0, ui->survive1, ui->survive2, ui->survive3, ui->survive4,…
duboisoc
  • 21
  • 1
0
votes
1 answer

PyQt5 - add AbstractButton to layout

I'm making a Solitaire card game to practice OOP and PyQt5, and I'm having trouble adding a card, which inherits QAbstractButton, to a layout (QGridLayout, QHBoxLayout, or QVBoxLayout). Here is part of the Card object: class Card(QAbstractButton): …
calcium3000
  • 177
  • 1
  • 10
0
votes
1 answer

Can i use my own user defined string in 'setDefaultButton'

I would like to use my own string on the button, in the the below mentioned functions "msgBox.setDefaultButton" and "msgBox.addButton" : msgBox.setDefaultButton(QMessageBox::Save); msgBox.addButton(QMessageBox::Abort); instead of "Save" and…
SirKappe
  • 55
  • 1
  • 7
1
2