Questions tagged [qtoolbutton]

In Qt, the QToolButton class provides a quick-access button to commands or options, usually used inside a QToolBar.

This is a part of the QtGui library

Detailed Description

The QToolButton class provides a quick-access button to commands or options, usually used inside a QToolBar.

A tool button is a special button that provides quick-access to specific commands or options. As opposed to a normal command button, a tool button usually doesn't show a text label, but shows an icon instead. Tool buttons are normally created when new QAction instances are created with QToolBar::addAction() or existing actions are added to a toolbar with QToolBar::addAction(). It is also possible to construct tool buttons in the same way as any other widget, and arrange them alongside other widgets in layouts. One classic use of a tool button is to select tools; for example, the "pen" tool in a drawing program. This would be implemented by using a QToolButton as a toggle button (see setToggleButton()).

QToolButton supports auto-raising. In auto-raise mode, the button draws a 3D frame only when the mouse points at it. The feature is automatically turned on when a button is used inside a QToolBar. Change it with setAutoRaise(). A tool button's icon is set as QIcon. This makes it possible to specify different pixmaps for the disabled and active state. The disabled pixmap is used when the button's functionality is not available. The active pixmap is displayed when the button is auto-raised because the mouse pointer is hovering over it. The button's look and dimension is adjustable with setToolButtonStyle() and setIconSize(). When used inside a QToolBar in a QMainWindow, the button automatically adjusts to QMainWindow's settings (see

QMainWindow::setToolButtonStyle() and QMainWindow::setIconSize()). Instead of an icon, a tool button can also display an arrow symbol, specified with arrowType. A tool button can offer additional choices in a popup menu. The popup menu can be set using setMenu(). Use setPopupMode() to configure the different modes available for tool buttons with a menu set. The default mode is DelayedPopupMode which is sometimes used with the "Back" button in a web browser. After pressing and holding the button down for a while, a menu pops up showing a list of possible pages to jump to. The default delay is 600 ms; you can adjust it with setPopupDelay().

Qt Documentation

55 questions
0
votes
1 answer

How to connect QToolButtons in QButtonGroup with the QRadioButtons?

I would like to connect QToolButtons in the QButtonGroup with QRadioButtons so that they perform same operations. Here is the code: QToolButton *A=new QToolButton(); A->setCheckable(true); QButtonGroup *group = new…
Veera
  • 331
  • 3
  • 15
0
votes
0 answers

How much space does QToolButton have for text?

I'm trying to subclass QToolButton to elide its text. To tell how much room is left for text, I have to take button width (available) and subtract from it: icon size (available), size of the button frame with shadows and other cute effects (can't…
sigil
  • 815
  • 8
  • 16
0
votes
0 answers

How to set Icons through Style sheet to each QActions, which are added to one QToolButton?

I have added 3 QActions to one QToolButton. And this QToolButton is in a QToolBar. like this: toolButton = new QToolButton(); action1 = new QAction(tr("Action 1"),this); action1->setObjectName("obj_action1"); …
jung
  • 557
  • 2
  • 4
  • 16
0
votes
1 answer

How to get the background color of QT-toolButton/pushButton using C++

Related Qusetions: How to get widget background QColor QWidget::palette().color(QWidget::backgroundRole()) How to get background color of a dialog/window? Qt QPlainTextEdit background There are at least 3 ways to solve the problem: // 1st QColor…
応振强
  • 266
  • 3
  • 12
0
votes
1 answer

QStyleSheet - setting border-image for button also sets background image for its tooltip

I'm having a problem with setting the border-image property of a QToolButton (later on also of a QPushButton but I assume the problem will occur there too). Each of my custom buttons (inheriting from QToolButton and QPushButton respectively) has to…
rbaleksandar
  • 8,713
  • 7
  • 76
  • 161
0
votes
1 answer

Qt 4.8.5 embedded: QToolButton text align

I have a problem with QToolButton and text alignement. I want to align left the text, but not works. I tryed, as reported in other forum : QToolButton *button = new QToolButton; QString style = QString("QToolButton{text-align:left;}"); …
Fabio
  • 1
  • 1
0
votes
1 answer

Same style for QPushButton and QToolButton during mouse-over

Is it possible to make QPushButton and QToolButton look identical during mouse-over, i.e. the look and feel for hover events? I don't use custom stylesheets, but there is a global application setting: QtGui.QApplication.setStyle("plastique") I'm…
0
votes
1 answer

Having a QToolButton w/ Menu being checked if any of the checkable QActions within that menu is checked

Say I have a QToolButton with a delayed action showing a menu. Said menu contains a number of checkable actions. In this particular case it's a button activating a zooming tool, and there are 3 zooming modi QActions available, organized in a…
datenwolf
  • 159,371
  • 13
  • 185
  • 298
-1
votes
1 answer

python pyqt5 Replace QMenu in QToolButton

File: ui.py # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'ui.ui' # # Created by: PyQt5 UI code generator 5.15.4 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit…
Chris P
  • 2,059
  • 4
  • 34
  • 68
-5
votes
1 answer

writing a gui application that acts a cash register in Qt

Please help me answer the following question: Write a gui that acts as a cash register. In other words, a client brings a basket of items, their bar-codes are scanned, and their total is calculated. The main window should have a menu bar with two…
1 2 3
4