Results 1 to 7 of 7

Thread: QMainWindows show empty QWidget

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2016
    Posts
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default QMainWindows show empty QWidget

    Hi, I've a little problem, this is my code.

    mainmindow.h

    Qt Code:
    1. #ifndef MAINWINDOW_H
    2. #define MAINWINDOW_H
    3.  
    4. #include <QMainWindow>
    5. #include <QLabel>
    6.  
    7. //class MdiChild;
    8. class QLabel;
    9. class QMenu;
    10. class QAction;
    11. class QMdiArea;
    12. class FrmMantenimientoSexo;
    13.  
    14. class MainWindow : public QMainWindow
    15. {
    16. Q_OBJECT
    17.  
    18. public:
    19. explicit MainWindow(const QString smwUserName/*, QWidget *parent = 0*/);
    20. ~MainWindow();
    21. void setUserName(QString smwUserName);
    22. QString getUserName();
    23.  
    24. private:
    25. QMdiArea *mdiArea;
    26. QString sUserName;
    27. QMenu *mnProceso;
    28. QMenu *mnMantenimiento;
    29. QMenu *mnTablas;
    30. QMenu *mnAyuda;
    31. QAction *acRegistro;
    32. QAction *acSalir;
    33. QAction *acTablaEstadoCivil;
    34. QAction *acTablaSexo;
    35. QAction *acFirstRecord;
    36. QAction *acPreviousRecord;
    37. QAction *acNextRecord;
    38. QAction *acLastRecord;
    39. QAction *acAcercaDe;
    40. QToolBar *tbProceso;
    41. QToolBar *tbIrA;
    42. QLabel *lbStatus;
    43. FrmMantenimientoSexo *wlffrmSexo;
    44. void createMenus();
    45. void createActions();
    46. void createToolBar();
    47. void createStatusBar();
    48. bool okToContinue();
    49.  
    50. private slots:
    51. void mantenimientoTablaEstadoCivil();
    52. void mantenimientoTablaSexo();
    53. void enableToolBar();
    54. FrmMantenimientoSexo *createFrmMantenimientoSexo();
    55.  
    56.  
    57. protected:
    58. void closeEvent(QCloseEvent *ceMainWindow);
    59.  
    60. signals:
    61. };
    62.  
    63. #endif // MAINWINDOW_H
    To copy to clipboard, switch view to plain text mode 

    mainmindow.cpp
    Qt Code:
    1. #include "mainwindow.h"
    2. #include <QMenu>
    3. #include <QMenuBar>
    4. #include <QToolBar>
    5. #include <QStatusBar>
    6. #include <QMessageBox>
    7. #include <QtGui>
    8. #include <QMdiArea>
    9. #include <QMdiSubWindow>
    10. #include "frmmantenimientosexo.h"
    11. #include "vwmantenimientosexo.h"
    12.  
    13.  
    14. MainWindow::MainWindow(const QString smwUserName/*, QWidget *parent*/)// : QMainWindow(parent)
    15. {
    16. mdiArea = new QMdiArea;
    17. setCentralWidget(mdiArea);
    18.  
    19. setUserName(smwUserName);
    20. setWindowTitle("JMadi: Sistema Integral [USUARIO: " + smwUserName + "]");
    21. createActions();
    22. createMenus();
    23. createToolBar();
    24. createStatusBar();
    25. setMinimumSize(1024,768);
    26. setAttribute(Qt::WA_DeleteOnClose);
    27. }
    28.  
    29. void MainWindow::mantenimientoTablaSexo()
    30. {
    31. tbIrA->setEnabled(true);
    32. wlffrmSexo = createFrmMantenimientoSexo();
    33. wlffrmSexo->show();
    34. }
    35.  
    36. FrmMantenimientoSexo *MainWindow::createFrmMantenimientoSexo()
    37. {
    38. QString strTable = "cp21021976.tb_sexo";
    39.  
    40. wlffrmSexo = new FrmMantenimientoSexo(getUserName(), strTable);
    41. mdiArea->addSubWindow(wlffrmSexo);
    42.  
    43. return wlffrmSexo;
    44. }
    To copy to clipboard, switch view to plain text mode 

    when the program run, I get:
    Screenshot from 2016-07-21 12:52:28.jpg

    why the widget is empty? can you help me please?
    Last edited by anda_skoa; 21st July 2016 at 21:18. Reason: changed [quote] to [code]

Similar Threads

  1. How to show MS Word int QWidget ?
    By luoyes in forum Qt Programming
    Replies: 8
    Last Post: 3rd December 2013, 04:22
  2. QWidget.show () is slow
    By rdf in forum Qt Programming
    Replies: 6
    Last Post: 7th December 2012, 15:04
  3. QTreeView - force to show expand arrows on empty folders
    By cierpliwy in forum Qt Programming
    Replies: 3
    Last Post: 19th August 2012, 01:09
  4. Replies: 5
    Last Post: 29th June 2010, 11:58
  5. QWidget::exec() and QWidget::show()
    By MarkoSan in forum Qt Programming
    Replies: 6
    Last Post: 18th October 2007, 21:39

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.