Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Hide QPushButton in release build and show it in debug mode
QtWS25 Last Chance

Hide QPushButton in release build and show it in debug mode

Scheduled Pinned Locked Moved Solved General and Desktop
debugreleaseqpushbutton
3 Posts 2 Posters 458 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    szumial
    wrote on last edited by
    #1

    Hello! Is there a way to hide certain UI objects when the Qt Widgets application is built in release mode, but show them in a debug build?

    For example, let's have a QPushButton added to the MainWindow with Qt Designer. Is it possible to do something like this (pseudo-code below)?

    MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)
    {
        ui->setupUi(this);
    
        if(RELEASE_MODE)    
        {    
            ui->pushButton->hide();    
        }
    }
    
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi

      Yes.

      #ifdef QT_DEBUG
      ....
      #endif

      or

      #ifndef QT_DEBUG
      ....
      #endif

      1 Reply Last reply
      4
      • S Offline
        S Offline
        szumial
        wrote on last edited by
        #3

        Thanks for this hint. Very useful for debugging purposes. Appreciate the help :)

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved