gqtbuttonswidget
Loading...
Searching...
No Matches
gqtbuttons_example.cc File Reference

Minimal GUI example for the Qt Buttons Widgets module. More...

#include "gQtButtonsWidget_options.h"
#include "gQtButtonsWidget.h"
#include <QApplication>
#include <QMainWindow>
#include <QTimer>
Include dependency graph for gqtbuttons_example.cc:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 Example entry point.
 

Detailed Description

This example demonstrates:

  • Parsing basic options using GOptions
  • Conditionally starting a Qt event loop only when --gui is enabled
  • Creating a GQTButtonsWidget using Qt resource-based SVG icons
  • Exiting the application after a user-configurable timeout

Definition in file gqtbuttons_example.cc.

Function Documentation

◆ main()

int main ( int argc,
char * argv[] )

Behavior:

  • Creates a GOptions instance to parse command-line arguments.
  • Reads:
    • gui : whether to run with a Qt GUI.
    • tt : timeout (milliseconds) after which the GUI exits automatically.
  • If gui is true:
    • Creates QApplication
    • Instantiates GQTButtonsWidget with two icon base names
    • Shows the widget
    • Uses QTimer::singleShot() to quit after tt milliseconds
  • If gui is false:
    • Runs in CLI mode (no GUI loop)
Parameters
argcStandard argument count.
argvStandard argument vector.
Returns
EXIT_SUCCESS on clean completion.

Definition at line 53 of file gqtbuttons_example.cc.