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. Menu bar does not show up
Forum Updated to NodeBB v4.3 + New Features

Menu bar does not show up

Scheduled Pinned Locked Moved General and Desktop
12 Posts 3 Posters 4.4k 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
    SahamGhazavi
    wrote on last edited by
    #3

    http://www.youtube.com/watch?v=wUH_gu2HdQE

    Thank you

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qxoz
      wrote on last edited by
      #4

      It is very strange if example not works as expected. Did you make any changes in code from example?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SahamGhazavi
        wrote on last edited by
        #5

        Nope. I even started the new project and just created one File menu with no submenu. Still does not show up when I run it!!

        1 Reply Last reply
        0
        • R Offline
          R Offline
          raf924
          wrote on last edited by
          #6

          Check if the menu bar is visible with the isVisible() function. You never know

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SahamGhazavi
            wrote on last edited by
            #7

            There is not visible property for the menu bar or I cannot find it.
            I even add this on main window constructor:
            ui->menuBar->setVisible(true);

            but didnt help

            1 Reply Last reply
            0
            • R Offline
              R Offline
              raf924
              wrote on last edited by
              #8

              There is : ui->menuBar->isVisible()
              Just out of curiosity : what version of Qt are you using?

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SahamGhazavi
                wrote on last edited by
                #9

                Qt Creator 2.7.0
                Based on Qt 5.0.2 (64 bit)

                Built on Apr 9 2013 at 09:31:19

                isVisible() just checks for visibility but I wanted to set the visibility :)

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SahamGhazavi
                  wrote on last edited by
                  #10

                  If the following always puts NO in the text filed
                  if(ui->menuBar->isVisible())
                  ui->plainTextEdit->setPlainText("YES");
                  else
                  ui->plainTextEdit->setPlainText("No");

                  1 Reply Last reply
                  0
                  • Q Offline
                    Q Offline
                    qxoz
                    wrote on last edited by
                    #11

                    Can you post your project?

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      SahamGhazavi
                      wrote on last edited by
                      #12

                      mainwindow.h
                      @
                      #ifndef MAINWINDOW_H
                      #define MAINWINDOW_H

                      #include <QMainWindow>
                      #include "mydialog.h"
                      namespace Ui {
                      class MainWindow;
                      }

                      class MainWindow : public QMainWindow
                      {
                      Q_OBJECT

                      public:
                      explicit MainWindow(QWidget *parent = 0);
                      ~MainWindow();

                      private slots:
                      void on_actionNew_Window_triggered();

                      private:
                      Ui::MainWindow *ui;
                      MyDialog *mDialog;
                      };

                      #endif // MAINWINDOW_H
                      @
                      @
                      mydialog.h

                      #ifndef MYDIALOG_H
                      #define MYDIALOG_H

                      #include <QDialog>

                      namespace Ui {
                      class MyDialog;
                      }

                      class MyDialog : public QDialog
                      {
                      Q_OBJECT

                      public:
                      explicit MyDialog(QWidget *parent = 0);
                      ~MyDialog();

                      private:
                      Ui::MyDialog *ui;
                      };

                      #endif // MYDIALOG_H
                      @
                      @
                      main.cpp

                      #include "mainwindow.h"
                      #include <QApplication>

                      int main(int argc, char *argv[])
                      {
                      QApplication a(argc, argv);
                      MainWindow w;
                      w.show();

                      return a.exec();
                      }
                      @
                      @
                      mainwindow.cpp

                      #include "mainwindow.h"
                      #include "ui_mainwindow.h"
                      #include "mydialog.h"
                      MainWindow::MainWindow(QWidget *parent) :
                      QMainWindow(parent),
                      ui(new Ui::MainWindow)
                      {

                      ui->setupUi(this);
                      //setCentralWidget(ui->plainTextEdit);
                      ui->menuBar->setVisible(true);
                      if(ui->menuBar->isVisible())
                      ui->plainTextEdit->setPlainText("IS");
                      else
                      ui->plainTextEdit->setPlainText("No");

                      }

                      MainWindow::~MainWindow()
                      {
                      delete ui;
                      }

                      void MainWindow::on_actionNew_Window_triggered()
                      {
                      mDialog = new MyDialog(this);
                      mDialog->show();
                      //mDialog.setModal(true);
                      //mDialog.exec();
                      }
                      @
                      @
                      mydialog.cpp

                      #include "mydialog.h"
                      #include "ui_mydialog.h"

                      MyDialog::MyDialog(QWidget *parent) :
                      QDialog(parent),
                      ui(new Ui::MyDialog)
                      {
                      ui->setupUi(this);
                      }

                      MyDialog::~MyDialog()
                      {
                      delete ui;
                      }
                      @
                      @
                      mainwindow.h

                      Thanks

                      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