Switch from custom layout to the QMainWindow layout scheme
This commit is contained in:
+31
-11
@@ -5,15 +5,15 @@
|
|||||||
|
|
||||||
#include "MessagingControls.h"
|
#include "MessagingControls.h"
|
||||||
|
|
||||||
MessagingControls::MessagingControls(QWidget* parent) : QDialog(parent)
|
MessagingControls::MessagingControls()
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Initialize controls
|
* Initialize controls
|
||||||
*/
|
*/
|
||||||
QVBoxLayout* everything = new QVBoxLayout;
|
//QVBoxLayout* everything = new QVBoxLayout;
|
||||||
|
|
||||||
//menuStuff = new QMenuBar;
|
//menuStuff = new QMenuBar;
|
||||||
mainWindow = new QMainWindow;
|
//mainWindow = new QMainWindow;
|
||||||
|
|
||||||
lblOfEncryptedBox = new QLabel(tr("Message: "));
|
lblOfEncryptedBox = new QLabel(tr("Message: "));
|
||||||
|
|
||||||
@@ -23,23 +23,28 @@ MessagingControls::MessagingControls(QWidget* parent) : QDialog(parent)
|
|||||||
encryptionButon = new QPushButton;
|
encryptionButon = new QPushButton;
|
||||||
|
|
||||||
//Adding lbl and line edit
|
//Adding lbl and line edit
|
||||||
QHBoxLayout* lblAndLineEdit = new QHBoxLayout;
|
//QHBoxLayout* lblAndLineEdit = new QHBoxLayout;
|
||||||
lblAndLineEdit->addWidget(lblOfEncryptedBox);
|
//lblAndLineEdit->addWidget(lblOfEncryptedBox);
|
||||||
lblAndLineEdit->addWidget(textToEncrypt);
|
//lblAndLineEdit->addWidget(textToEncrypt);
|
||||||
|
|
||||||
//Adding button
|
//Adding button
|
||||||
QHBoxLayout* button = new QHBoxLayout;
|
//QHBoxLayout* button = new QHBoxLayout;
|
||||||
button->addWidget(encryptionButon);
|
//button->addWidget(encryptionButon);
|
||||||
|
|
||||||
//Add everything
|
//Add everything
|
||||||
//everything->addLayout(menuStuff);
|
//everything->addLayout(menuStuff);
|
||||||
everything->addLayout(lblAndLineEdit);
|
//everything->addLayout(lblAndLineEdit);
|
||||||
everything->addLayout(button);
|
//everything->addLayout(button);
|
||||||
|
|
||||||
|
createMenus();
|
||||||
|
|
||||||
QDockWidget* lblAndArea = new QDockWidget(tr("Dock Widget"));
|
QDockWidget* lblAndArea = new QDockWidget(tr("Dock Widget"));
|
||||||
lblAndArea->setWidget(textToEncrypt);
|
lblAndArea->setWidget(textToEncrypt);
|
||||||
|
//lblAndArea->setWidget(lblOfEncryptedBox);
|
||||||
|
|
||||||
mainWindow->addDockWidget(Qt::LeftDockWidgetArea, lblAndArea);
|
addDockWidget(Qt::LeftDockWidgetArea, lblAndArea);
|
||||||
|
|
||||||
|
//mainWindow->addDockWidget(Qt::LeftDockWidgetArea, lblAndArea);
|
||||||
//mainWindow->addDockWidget(lblAndArea);
|
//mainWindow->addDockWidget(lblAndArea);
|
||||||
//mainWindow->addDockWidget(textToEncrypt);
|
//mainWindow->addDockWidget(textToEncrypt);
|
||||||
//mainWindow->addDockWidget(encryptionButon);
|
//mainWindow->addDockWidget(encryptionButon);
|
||||||
@@ -60,3 +65,18 @@ MessagingControls::~MessagingControls()
|
|||||||
//delete encryptedBox;
|
//delete encryptedBox;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MessagingControls::createMenus()
|
||||||
|
{
|
||||||
|
fileMenu = menuBar()->addMenu(tr("File"));
|
||||||
|
editMenu = menuBar()->addMenu(tr("Edit"));
|
||||||
|
|
||||||
|
closeApplication = new QAction(tr("Quit Application"));
|
||||||
|
keyEdit = new QAction(tr("Key Edit"));
|
||||||
|
|
||||||
|
fileMenu->addAction(closeApplication);
|
||||||
|
|
||||||
|
editMenu->addAction(keyEdit);
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
+14
-4
@@ -8,6 +8,8 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
@@ -15,26 +17,34 @@ class QTextEdit;
|
|||||||
class QPushButton;
|
class QPushButton;
|
||||||
class QMenuBar;
|
class QMenuBar;
|
||||||
class QMainWindow;
|
class QMainWindow;
|
||||||
|
class QMenu;
|
||||||
|
class QAction;
|
||||||
|
|
||||||
class MessagingControls : public QDialog
|
class MessagingControls : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MessagingControls(QWidget* parent = 0);
|
MessagingControls();
|
||||||
~MessagingControls();
|
~MessagingControls();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void createMenus();
|
||||||
|
|
||||||
QLineEdit* encryptedBox;
|
QLineEdit* encryptedBox;
|
||||||
QLabel* lblOfEncryptedBox;
|
QLabel* lblOfEncryptedBox;
|
||||||
QTextEdit* textToEncrypt;
|
QTextEdit* textToEncrypt;
|
||||||
QPushButton* encryptionButon;
|
QPushButton* encryptionButon;
|
||||||
QMenuBar* menuStuff;
|
QMenu* fileMenu;
|
||||||
QMainWindow* mainWindow;
|
QMenu* editMenu;
|
||||||
|
QAction* closeApplication;
|
||||||
|
QAction* keyEdit;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user