{
ui.setupUi( this );
// create tabs
ui.tabWidget = m_tabWidget;
m_tabDMX = new DMXTable( m_tabWidget );
ui.tabWidget->addTab( m_tabDMX, tr("Tab_1") );
m_tabAll = new AllTable( m_tabWidget );
ui.tabWidget->addTab( m_tabAll, tr("Tab_2") );
// Load frame with required stuff; Place widgets in frame; left to right
qFrame
->setFrameRect
( QRect( 0,
0,
0,
0 ) );
// Checkbox in frame
m_onlineChk
= new QCheckBox( "Show Online Table ", qFrame
);
connect( m_onlineChk, SIGNAL( clicked() ), this, SLOT( onlineClicked() ) );
m_onlineChk->setCheckState( Qt::Checked );
frameLayout
->setSizeConstraint
( QLayout::SetMaximumSize );
frameLayout->addWidget( m_onlineChk, 0, Qt::AlignRight );
frameLayout->insertStretch( 0, 0 );
qFrame->setLayout( frameLayout );
// Put everything onto the main window.
// Tab widget is 1st
m_centralLayout->addWidget( m_tabWidget, 1, 0, 1, 1);
m_centralLayout->setRowMinimumHeight( 1, 300 );
// Frame is on bottom (just above the status bar)
m_centralLayout->addWidget( qFrame, 2, 0, 1, 1 );
m_centralLayout->setRowMinimumHeight( 2, 30 );
setCentralWidget( m_pCentralWidget );
m_pCentralWidget->setLayout( m_centralLayout );
m_pExitAct
= new QAction( tr
("E&xit"),
this );
m_pExitAct->setShortcut( tr("Ctrl+Q") );
connect( m_pExitAct, SIGNAL(triggered()), this, SLOT(close()) );
m_pFileMenu = menuBar()->addMenu( tr("&File") );
m_pFileMenu->addAction( m_pExitAct );
show();
} // MainWin
{
m_parent = pParent;
createConfigTable();
createOnlineTable();
layout->addSpacing( 25 );
layout->addWidget( m_configGroupBox );
layout->addWidget( m_onlineGroupBox );
}
void DMXTable::createConfigTable( void )
{
sLabels << "Status" << "Name" << "Type" << "IP Address" << "Model Name";
// Set up the table area.
m_configGroupBox
= new QGroupBox( tr
("Configured Devices"), m_parent
);
m_pConfigTable
= new QTableWidget( 1,
5, m_configGroupBox
);
m_pConfigTable->setHorizontalHeaderLabels( sLabels );
m_pConfigTable->setColumnWidth( 0, 40 );
m_pConfigTable->setColumnWidth( 1, 150 );
m_pConfigTable->setColumnWidth( 2, 130 );
m_pConfigTable->setColumnWidth( 3, 120 );
m_pConfigTable->setColumnWidth( 4, 150 );
layout->addWidget( m_pConfigTable );
m_configGroupBox->setLayout( layout );
}
void DMXTable::createOnlineTable( void )
{
sLabels << "Status" << "Name" << "Type" << "IP Address" << "Model Name";
// Set up the table area.
m_onlineGroupBox
= new QGroupBox( tr
("Online Devices"), m_parent
);
m_pOnlineTable
= new QTableWidget( 1,
5, m_onlineGroupBox
);
m_pOnlineTable->setHorizontalHeaderLabels( sLabels );
m_pOnlineTable->setColumnWidth( 0, 40 );
m_pOnlineTable->setColumnWidth( 1, 150 );
m_pOnlineTable->setColumnWidth( 2, 130 );
m_pOnlineTable->setColumnWidth( 3, 120 );
m_pOnlineTable->setColumnWidth( 4, 150 );
layout->addWidget( m_pOnlineTable );
m_onlineGroupBox->setLayout( layout );
}
MainWin::MainWin( QWidget* parent, Qt::WFlags flags ) : QMainWindow( parent, flags )
{
ui.setupUi( this );
m_pCentralWidget = new QWidget;
// create tabs
m_tabWidget = new QTabWidget( this );
ui.tabWidget = m_tabWidget;
m_tabDMX = new DMXTable( m_tabWidget );
ui.tabWidget->addTab( m_tabDMX, tr("Tab_1") );
m_tabAll = new AllTable( m_tabWidget );
ui.tabWidget->addTab( m_tabAll, tr("Tab_2") );
// Load frame with required stuff; Place widgets in frame; left to right
QFrame* qFrame = new QFrame( this );
qFrame->setFrameRect( QRect( 0, 0, 0, 0 ) );
qFrame->setFrameStyle( QFrame::Box | QFrame::Plain );
// Checkbox in frame
m_onlineChk = new QCheckBox( "Show Online Table ", qFrame );
connect( m_onlineChk, SIGNAL( clicked() ), this, SLOT( onlineClicked() ) );
m_onlineChk->setCheckState( Qt::Checked );
QHBoxLayout* frameLayout = new QHBoxLayout( qFrame );
frameLayout->setSizeConstraint( QLayout::SetMaximumSize );
frameLayout->addWidget( m_onlineChk, 0, Qt::AlignRight );
frameLayout->insertStretch( 0, 0 );
qFrame->setLayout( frameLayout );
// Put everything onto the main window.
m_centralLayout = new QGridLayout;
// Tab widget is 1st
m_centralLayout->addWidget( m_tabWidget, 1, 0, 1, 1);
m_centralLayout->setRowMinimumHeight( 1, 300 );
// Frame is on bottom (just above the status bar)
m_centralLayout->addWidget( qFrame, 2, 0, 1, 1 );
m_centralLayout->setRowMinimumHeight( 2, 30 );
setCentralWidget( m_pCentralWidget );
m_pCentralWidget->setLayout( m_centralLayout );
m_pExitAct = new QAction( tr("E&xit"), this );
m_pExitAct->setShortcut( tr("Ctrl+Q") );
connect( m_pExitAct, SIGNAL(triggered()), this, SLOT(close()) );
m_pFileMenu = menuBar()->addMenu( tr("&File") );
m_pFileMenu->addAction( m_pExitAct );
show();
} // MainWin
DMXTable::DMXTable( QWidget* pParent ) : QWidget( pParent )
{
m_parent = pParent;
createConfigTable();
createOnlineTable();
QVBoxLayout* layout = new QVBoxLayout( pParent );
layout->addSpacing( 25 );
layout->addWidget( m_configGroupBox );
layout->addWidget( m_onlineGroupBox );
}
void DMXTable::createConfigTable( void )
{
QStringList sLabels;
sLabels << "Status" << "Name" << "Type" << "IP Address" << "Model Name";
// Set up the table area.
m_configGroupBox = new QGroupBox( tr("Configured Devices"), m_parent );
m_pConfigTable = new QTableWidget( 1, 5, m_configGroupBox );
m_pConfigTable->setHorizontalHeaderLabels( sLabels );
m_pConfigTable->setColumnWidth( 0, 40 );
m_pConfigTable->setColumnWidth( 1, 150 );
m_pConfigTable->setColumnWidth( 2, 130 );
m_pConfigTable->setColumnWidth( 3, 120 );
m_pConfigTable->setColumnWidth( 4, 150 );
QHBoxLayout* layout = new QHBoxLayout( m_configGroupBox );
layout->addWidget( m_pConfigTable );
m_configGroupBox->setLayout( layout );
}
void DMXTable::createOnlineTable( void )
{
QStringList sLabels;
sLabels << "Status" << "Name" << "Type" << "IP Address" << "Model Name";
// Set up the table area.
m_onlineGroupBox = new QGroupBox( tr("Online Devices"), m_parent );
m_pOnlineTable = new QTableWidget( 1, 5, m_onlineGroupBox );
m_pOnlineTable->setHorizontalHeaderLabels( sLabels );
m_pOnlineTable->setColumnWidth( 0, 40 );
m_pOnlineTable->setColumnWidth( 1, 150 );
m_pOnlineTable->setColumnWidth( 2, 130 );
m_pOnlineTable->setColumnWidth( 3, 120 );
m_pOnlineTable->setColumnWidth( 4, 150 );
QHBoxLayout* layout = new QHBoxLayout( m_onlineGroupBox );
layout->addWidget( m_pOnlineTable );
m_onlineGroupBox->setLayout( layout );
}
To copy to clipboard, switch view to plain text mode
Bookmarks