[Kst] extragear/graphics/kst/kst
George Staikos
staikos at kde.org
Mon Nov 28 00:05:04 CET 2005
SVN commit 483737 by staikos:
embed the custom widget if there is one. The label dialog now uses the
embedded dialog, but it doesn't work. It needs a .ui.h with all the logic.
We need to define a way to pass the viewobject pointer into the dialog, or
have a function in the viewobject that takes a pointer to the custom widget
and populates it or reads from it as needed.
M +1 -0 Makefile.am
M +18 -4 ksteditviewobjectdialog_i.cpp
M +2 -0 ksteditviewobjectdialog_i.h
M +3 -8 kstviewlabel.cpp
M +1 -1 viewlabelwidget.ui
--- trunk/extragear/graphics/kst/kst/Makefile.am #483736:483737
@@ -154,6 +154,7 @@
kstfittable.cpp \
kstlogwidget.cpp \
kstplotbase.cpp \
+ viewlabelwidget.ui \
kstviewlabel.cpp \
kstplotlabel.cpp \
kst2dplot.cpp \
--- trunk/extragear/graphics/kst/kst/ksteditviewobjectdialog_i.cpp #483736:483737
@@ -38,10 +38,9 @@
KstEditViewObjectDialogI::KstEditViewObjectDialogI(QWidget* parent, const char* name, bool modal, WFlags fl)
: KstEditViewObjectDialog(parent, name, modal, fl) {
-
connect(_cancel, SIGNAL(clicked()), this, SLOT(close()));
connect(_OK, SIGNAL(clicked()), this, SLOT(okClicked()));
-
+
_grid = 0L;
_viewObject = 0L;
@@ -81,6 +80,7 @@
delete *i;
}
_widgets.clear();
+ delete _customWidget;
// and the delete the grid itself
delete _grid;
_grid = 0L;
@@ -93,6 +93,14 @@
// get the qt properties of the viewobject
if (_viewObject) {
+ _customWidget = _viewObject->configWidget();
+ if (_customWidget) {
+ _grid = new QGridLayout(_propertiesFrame, 1, 1);
+ _customWidget->reparent(_propertiesFrame, QPoint(0, 0));
+ _grid->addWidget(_customWidget, 0, 0);
+ return;
+ }
+
int numProperties = _viewObject->metaObject()->numProperties(true);
// create a new grid
@@ -199,7 +207,6 @@
void KstEditViewObjectDialogI::fillPenStyleWidget(QComboBox* widget) {
-
QRect rect = widget->style().querySubControlMetrics(QStyle::CC_ComboBox,
widget,
QStyle::SC_ComboBoxEditField);
@@ -248,7 +255,14 @@
void KstEditViewObjectDialogI::okClicked() {
- if (_viewObject) {
+ if (!_viewObject) {
+ close();
+ return;
+ }
+
+ if (_customWidget) {
+ // FILL ME IN TODO
+ } else {
// get all the properties and set them
for (QValueList<QWidget*>::ConstIterator iter = _inputWidgets.begin(); iter != _inputWidgets.end(); ++iter) {
--- trunk/extragear/graphics/kst/kst/ksteditviewobjectdialog_i.h #483736:483737
@@ -22,6 +22,7 @@
#include "kstviewobject.h"
#include "ksttoplevelview.h"
#include "kst_export.h"
+#include <qguardedptr.h>
class KST_EXPORT KstEditViewObjectDialogI : public KstEditViewObjectDialog {
Q_OBJECT
@@ -50,6 +51,7 @@
QValueList<QWidget*> _inputWidgets; // the widgets used to change properties
QValueList<QWidget*> _widgets; // all other widgets
QGridLayout* _grid;
+ QGuardedPtr<QWidget> _customWidget;
private slots:
void okClicked();
--- trunk/extragear/graphics/kst/kst/kstviewlabel.cpp #483736:483737
@@ -25,8 +25,8 @@
#include "labelrenderer.h"
#include "kstsettings.h"
#include "ksttimers.h"
+#include "viewlabelwidget.h"
-
#include <kdatastream.h>
#include <kglobal.h>
#include <klocale.h>
@@ -39,12 +39,7 @@
#include <stdlib.h>
-/*
-TODO:
-- Optimize
-- Rendering testcases
-- Show everyone that this rocks
-*/
+/* TODO: Rendering testcases */
#define MIN_FONT_SIZE 5
KstViewLabel::KstViewLabel(const QString& txt, KstLJustifyType justify, float rotation)
@@ -686,7 +681,7 @@
QWidget *KstViewLabel::configWidget() {
- return 0L;
+ return new ViewLabelWidget;
}
#include "kstviewlabel.moc"
--- trunk/extragear/graphics/kst/kst/viewlabelwidget.ui #483736:483737
@@ -1,5 +1,5 @@
<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
-<class>KstViewLabelWidget</class>
+<class>ViewLabelWidget</class>
<widget class="QWidget">
<property name="name">
<cstring>viewLabelWidget</cstring>
More information about the Kst
mailing list