TabDialog
::TabDialog(QWidget *parent,
const char *name,
const QString &_filename
) : QFrame(parent, name
), filename
(_filename
), fileinfo
(filename
) {
//widget1 = new QWidget(this);
//widget2 = new QWidget(this);
tabbar
->setShape
(QTabBar::RoundedAbove);
tabbar->addTab(viewtab = new QTab("aaaaaaaaaaaaa"));
tabbar->addTab(consoletab = new QTab("dddddddddddd"));
widgetstack = new QWidgetStack(this);
widgetstack
->addWidget
(label1
= new QLabel("ccccccccccc",
this),
1);
widgetstack
->addWidget
(label2
= new QLabel("ggggggggggg",
this),
2);
connect(tabbar, SIGNAL(selected(1)), this, SLOT(setTab(1)));
connect(tabbar, SIGNAL(selected(2)), this, SLOT(setTab(2)));
//connect( this, SIGNAL( applyButtonPressed() ), this, SLOT( ));
}
void TabDialog::setTab(int id)
{
widgetstack->raiseWidget(id);
tabbar->setCurrentTab(id);
resizeEvent(0);
}
// leave this, it's for resizing the frame and then you need sizehints for that
{
if(e)
tabbar->setGeometry(200,0,200,30);
label1->setGeometry(100,50,20,20);
label2->setGeometry(100,100,20,20);
}
TabDialog::TabDialog(QWidget *parent, const char *name, const QString &_filename)
: QFrame(parent, name), filename(_filename), fileinfo(filename)
{
//widget1 = new QWidget(this);
//widget2 = new QWidget(this);
tabbar = new QTabBar(this);
tabbar->setShape(QTabBar::RoundedAbove);
tabbar->addTab(viewtab = new QTab("aaaaaaaaaaaaa"));
tabbar->addTab(consoletab = new QTab("dddddddddddd"));
widgetstack = new QWidgetStack(this);
widgetstack->addWidget(label1= new QLabel("ccccccccccc", this), 1);
widgetstack->addWidget(label2 = new QLabel("ggggggggggg", this), 2);
label1->setFrameStyle(QFrame::Panel | QFrame::Sunken);
label2->setFrameStyle(QFrame::Panel | QFrame::Sunken);
connect(tabbar, SIGNAL(selected(1)), this, SLOT(setTab(1)));
connect(tabbar, SIGNAL(selected(2)), this, SLOT(setTab(2)));
//connect( this, SIGNAL( applyButtonPressed() ), this, SLOT( ));
}
void TabDialog::setTab(int id)
{
widgetstack->raiseWidget(id);
tabbar->setCurrentTab(id);
resizeEvent(0);
}
// leave this, it's for resizing the frame and then you need sizehints for that
void TabDialog::resizeEvent(QResizeEvent *e)
{
if(e)
QFrame::resizeEvent(e);
tabbar->setGeometry(200,0,200,30);
label1->setGeometry(100,50,20,20);
label2->setGeometry(100,100,20,20);
}
To copy to clipboard, switch view to plain text mode
Bookmarks