CommandLink buttons with Qt
Windows Vista introduced the concept of command links. A command link is a special button type primarily designed to streamline Wizard-like interfaces. Pressing a command link should always take you to a different page, just like in a web browser. In addition to the visual difference, it can also include a descriptive text.
A command link class did not make it into 4.3, and it has not yet been decided if it will be part of our standard widget set.
However some support was added in the style API to support these features, so I decided to make a small
example on how to implement this functionality using Qt 4.3. In fact, the screen shot above was made using Qt.
You can try out the following subclass of QPushButton that adds these features : commandlink.h and commandlink.cpp . Note that the size hint calculation is somewhat rudimentary and does not guarantee the visibility of the description text.
To use this in a QWizard you could do something like this :
button.setDescription("Pressing this button should do something");
The only thing remaining now is to connect the clicked signal to for instance QWizard::next(). Note that the code will also work on other platforms and styles. This is the above button rendered with Plastique style :
Update 05.21.07 : Tweaked the font settings a bit
Subscribe to our newsletter
Try Qt 6.3 Now!
Download the latest release here: www.qt.io/download.
Qt 6 was created to be the productivity platform for the future, with next-gen 2D & 3D UX and limitless scalability.
Explore Qt World
Check our Qt demos and case studies in the virtual Qt World
Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.
Näytä tämä julkaisu Instagramissa.
Want to build something for tomorrow, join #QtPeople today! We have loads of cool jobs you don't want to miss! http://qt.io/careers #builtwithQt #software #developers #coding #framework #tool #tooling #C++ #QML #engineers #sales #tech #technology #UI #UX #CX #Qt #Qtdev #global #openpositions #careers #job
Henkilön Qt (@theqtcompany) jakama julkaisu