[Kst] branches/work/kst/portto4/kst/src/libkstapp
Mike Fenton
mike at staikos.net
Tue Oct 28 16:28:51 CET 2008
SVN commit 877043 by fenton:
Rework DialogPage to allow for non-Tab based widgets.
M +34 -7 dialogpage.cpp
M +19 -4 dialogpage.h
M +1 -1 viewitemdialog.cpp
--- branches/work/kst/portto4/kst/src/libkstapp/dialogpage.cpp #877042:877043
@@ -19,9 +19,7 @@
namespace Kst {
DialogPage::DialogPage(Dialog *parent)
- : QTabWidget(parent), _dialog(parent) {
-
- tabBar()->setVisible(false);
+ : QWidget(parent), _dialog(parent) {
}
@@ -39,17 +37,46 @@
connect(this, SIGNAL(apply()), tab, SIGNAL(apply()));
connect(this, SIGNAL(cancel()), tab, SIGNAL(cancel()));
connect(tab, SIGNAL(modified()), this, SIGNAL(modified()));
- addTab(tab, tab->tabTitle());
+ _widget = tab;
+ QVBoxLayout *layout = new QVBoxLayout(this);
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->addWidget(tab);
+ setLayout(layout);
}
-void DialogPage::setVisible(bool visible) {
+QWidget* DialogPage::currentWidget() {
+ return _widget;
+}
- tabBar()->setVisible(count() > 1);
+DialogPageTab::DialogPageTab(Dialog *parent)
+ : DialogPage(parent) {
- QTabWidget::setVisible(visible);
+ _tabWidget = new QTabWidget(this);
+ QVBoxLayout *layout = new QVBoxLayout(this);
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->addWidget(_tabWidget);
+ setLayout(layout);
}
+
+DialogPageTab::~DialogPageTab() {
}
+
+void DialogPageTab::addDialogTab(DialogTab *tab) {
+ connect(this, SIGNAL(ok()), tab, SIGNAL(ok()));
+ connect(this, SIGNAL(apply()), tab, SIGNAL(apply()));
+ connect(this, SIGNAL(cancel()), tab, SIGNAL(cancel()));
+ connect(tab, SIGNAL(modified()), this, SIGNAL(modified()));
+ _tabWidget->addTab(tab, tab->tabTitle());
+}
+
+
+QWidget* DialogPageTab::currentWidget() {
+ return _tabWidget->currentWidget();
+}
+
+}
+
// vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/dialogpage.h #877042:877043
@@ -22,7 +22,7 @@
class Dialog;
class DialogTab;
-class KST_EXPORT DialogPage : public QTabWidget
+class KST_EXPORT DialogPage : public QWidget
{
Q_OBJECT
public:
@@ -39,21 +39,36 @@
void addDialogTab(DialogTab *tab);
+ virtual QWidget* currentWidget();
+
Q_SIGNALS:
void ok();
void apply();
void cancel();
void modified();
- protected:
- void setVisible(bool visible);
-
private:
QString _pageTitle;
QPixmap _pageIcon;
QPointer<Dialog> _dialog;
+ QWidget* _widget;
};
+class KST_EXPORT DialogPageTab : public DialogPage
+{
+ Q_OBJECT
+ public:
+ DialogPageTab(Dialog *parent);
+ virtual ~DialogPageTab();
+
+ void addDialogTab(DialogTab *tab);
+
+ QWidget* currentWidget();
+
+ private:
+ QTabWidget* _tabWidget;
+};
+
}
#endif
--- branches/work/kst/portto4/kst/src/libkstapp/viewitemdialog.cpp #877042:877043
@@ -36,7 +36,7 @@
connect(_strokeTab, SIGNAL(apply()), this, SLOT(strokeChanged()));
connect(_layoutTab, SIGNAL(apply()), this, SLOT(layoutChanged()));
- DialogPage *page = new DialogPage(this);
+ DialogPageTab *page = new DialogPageTab(this);
page->setPageTitle(tr("Appearance"));
page->addDialogTab(_fillTab);
page->addDialogTab(_strokeTab);
More information about the Kst
mailing list