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
Forum Updated to NodeBB v4.3 + New Features

Hide QPushButton in release build and show it in debug mode

Scheduled Pinned Locked Moved Solved General and Desktop
debugreleaseqpushbutton
3 Posts 2 Posters 479 Views 1 Watching
  • 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 8 Sept 2021, 11:27 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
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 8 Sept 2021, 11:30 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 8 Sept 2021, 12:12 last edited by
        #3

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

        1 Reply Last reply
        0

        1/3

        8 Sept 2021, 11:27

        • Login

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