--- as_gui.cpp 2002/11/14 18:19:29 1.7
+++ as_gui.cpp 2002/11/14 20:29:33 1.8
@@ -35,13 +35,20 @@
Titraqform::Titraqform(QWidget *pParent, const char *kszName, WFlags Flags) :
QMainWindow(pParent, kszName, Flags)
{
+// // Abstract main widget building
+// setupMenubar();
+// setupFiletools();
+// setupStatusbar();
+// setupCentralwidget();
+
// Initial widget manipulations
if (!kszName)
setName(trUtf8("Titraqform"));
resize(600, 480);
- m_pMenubar = this->menuBar();
- m_pStatbar = this->statusBar();
- m_pStatbar->message(trUtf8("Ready"));
+ m_pMenubar = menuBar(); // Setup the menu bar
+// m_pMenubar = new QMenuBar(this, "Menubar");
+// m_pStatbar = new QStatusBar(this, "Statusbar");
+ m_pStatbar = statusBar(); // Setup the status bar
setCaption("OSSP Titraq");
// File new action
@@ -84,6 +91,9 @@
// setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0,
// (QSizePolicy::SizeType)0, 0, 0, sizePolicy().hasHeightForWidth()));
+ // Make an easter egg ;-)
+ QToolTip::add(m_pMenubar, QRect(0, 0, 2, 2), "Easter egg");
+
// Construct and populate the file menu with actions
QPopupMenu *pFilepopup = new QPopupMenu(this);
m_pMenubar->insertItem(trUtf8("&File"), pFilepopup);
@@ -108,21 +118,25 @@
m_pToolbar->setLabel(trUtf8("File Ops"));
m_pFileopenact->addTo(m_pToolbar);
m_pFilesaveact->addTo(m_pToolbar);
-
- // Add a preconfigured whats this button to our new tool bar
- QWhatsThis::whatsThisButton(m_pToolbar);
+ QWhatsThis::whatsThisButton(m_pToolbar); // Preconfigured whats this button
// Create a central frame and associated layout for QMainWindow
- m_pCenframe = new QFrame(this);
+ m_pCenframe = new QFrame(this, "Centralframe");
+ m_pCenframe->setFrameShape(QFrame::StyledPanel);
+ m_pCenframe->setFrameShadow(QFrame::Sunken);
setCentralWidget(m_pCenframe);
- // Control layouts for form, table, and status line
- m_pTitraqformlayout = new QVBoxLayout(m_pCenframe, 11, 6, "Titraqformlayout");
- m_pMainlayout = new QVBoxLayout(0, 0, 6, "Mainlayout"); // For layouts
- m_pPackagelayout = new QVBoxLayout(0, 0, 6, "Packagelayout"); // For table
+ // Layout controls for toolbar, table, buttons, and status line
+ m_pMainlayout = new QVBoxLayout(m_pCenframe, 10, 6, "Mainlayout"); // For layouts
+ m_pPackagelayout = new QVBoxLayout(0, 0, 6, "Packagelayout"); // For table
+ m_pControllayout = new QHBoxLayout(0, 0, 6, "Controllayout"); // For buttons
+
+ // Specify ordering of the layouts
+ m_pMainlayout->addLayout(m_pPackagelayout);
+ m_pMainlayout->addLayout(m_pControllayout);
// The table itself
- m_pMaintable = new QTable(this, "Maintable");
+ m_pMaintable = new QTable(m_pCenframe, "Maintable");
m_pMaintable->setNumRows(g_knRows);
m_pMaintable->setNumCols(g_knCols);
m_pMaintable->setReadOnly(false); // Not read only
@@ -220,20 +234,16 @@
m_pPackagelayout->addWidget(m_pMaintable); // Finally add the table widget
// Bottom output line
- m_pStatus = new QLineEdit(this, "Status");
+ m_pStatus = new QLineEdit(m_pCenframe, "Status");
m_pStatus->setFrameShape(QLineEdit::LineEditPanel);
m_pStatus->setFrameShadow(QLineEdit::Sunken);
m_pStatus->setFrame(true);
m_pStatus->setReadOnly(true);
QToolTip::add(m_pStatus, trUtf8("Status Line"));
m_pPackagelayout->addWidget(m_pStatus);
- m_pMainlayout->addLayout(m_pPackagelayout);
-
- // Control layout for push buttons
- m_pControllayout = new QHBoxLayout(0, 0, 6, "Controllayout"); // For buttons
// Tuple push button add
- m_pAddbutton = new QPushButton(this, "AddButton");
+ m_pAddbutton = new QPushButton(m_pCenframe, "AddButton");
m_pAddbutton->setCursor(QCursor(13));
m_pAddbutton->setText(trUtf8("&Add"));
QToolTip::add(m_pAddbutton, trUtf8("Add Entry"));
@@ -241,7 +251,7 @@
m_pControllayout->addWidget(m_pAddbutton);
// Tuple push button delete
- m_pDeletebutton = new QPushButton(this, "Deletebutton");
+ m_pDeletebutton = new QPushButton(m_pCenframe, "Deletebutton");
m_pDeletebutton->setCursor(QCursor(13));
m_pDeletebutton->setText(trUtf8("&Delete"));
m_pDeletebutton->setFlat(false);
@@ -250,7 +260,7 @@
m_pControllayout->addWidget(m_pDeletebutton);
// Tuple push button write
- m_pWritebutton = new QPushButton(this, "Writebutton");
+ m_pWritebutton = new QPushButton(m_pCenframe, "Writebutton");
m_pWritebutton->setCursor(QCursor(13));
m_pWritebutton->setText(trUtf8("&Write"));
QToolTip::add(m_pWritebutton, trUtf8("Write Entry"));
@@ -258,7 +268,7 @@
m_pControllayout->addWidget(m_pWritebutton);
// Tuple push button quit
- m_pQuitbutton = new QPushButton(this, "Quitbutton");
+ m_pQuitbutton = new QPushButton(m_pCenframe, "Quitbutton");
m_pQuitbutton->setCursor(QCursor(13));
m_pQuitbutton->setText(trUtf8("&Quit"));
m_pQuitbutton->setFlat(false);
@@ -266,10 +276,8 @@
connect(m_pQuitbutton, SIGNAL(clicked()), qApp, SLOT(quit()));
m_pControllayout->addWidget(m_pQuitbutton);
- m_pMainlayout->addLayout(m_pControllayout);
- m_pTitraqformlayout->addLayout(m_pMainlayout);
-
init(); // Initialize signal and slot connections
+ m_pStatbar->message(trUtf8("Ready"));
}
//
|