< Kexi
Revision as of 16:42, 22 December 2014 by Jstaniek (talk | contribs) (→‎Forms)

Kexi/Porting to Qt&KDE 4

Original document on kexi-project.org. We'll want to integrate the notes in a single page one day...


Forms Porting

Status: mostly DONE, some QPalette porting remains
  • WidgetList -> QWidgetList, WidgetListIterator -> QWidgetList::Iterator/QWidgetList::ConstIterator/QMutableListIterator<QWidget*>
  • standard widgets: List View -> List Widget (and QListView -> QListWidget)
  • WidgetInfo::Dict -> WidgetInfo::Hash
  • K3ListBox support removed: rarely used before
  • K3ListView support removed, TODO: use QTreeWidget or QTreeView
  • Container factory:
    • stacked widget's property "id" replaced with "stackIndex" property (int).
    • tab widget: currentPage property (QWidget*) -> currentIndex (int)

Forms Refactoring

1st Phase

Started by Jstaniek on 3 Jan 2009, finished on 18 Feb 2009

Status: formeditor/ & plugins/forms/ done

Reasons for refactoring:

  • The process of instantiating a form (the Form class) is very complicated now what makes it very hard to properly implement subforms
  • The code full of interdependencies and thus is fragile when adding new functionality or fixing bugs
  • The FormManager class centralizes a number of operations that shall belong to Form itself
  • The naming of methods and classes can be improved, e.g. Form -> FormController
  • The ObjectTree* classes introduce redundancy as we already have QWidget hierarchy, and extensible property system; this complicates the code


  • Form and FormManager:
    • FormManager removed. Most facilities of FormManager merged into Form. Thus we are no longer track 'active form' on switching between forms; instead each Form object keeps necessary information.
    • void FormManager::insertWidget(const QByteArray &classname) moved
    • void FormManager::stopInsert() moved as abortWidgetInserting()
    • void FormManager::enterConnectingState() moved as enterConnectingState()
    • void FormManager::stopCreatingConnection() moved as abortCreatingConnection()
    • void FormManager::slotPointerClicked() moved as enterWidgetSelectingState()
    • Form::State enum defined instead of multiple boolean attributes of FormManager
    • FormManager::isInserting() and FormManager::isCreatingConnection() removed, Form::state() is used instead
    • Design or View mode is expressed using Mode enum value, not boolean flag
    • Form::setSelectedWidget(QWidget *w, bool add, bool dontRaise, bool moreWillBeSelected) replaced with Form::selectWidget(QWidget *w, Form::WidgetSelectionFlags)
    • Form::deSelectWidget(QWidget*) replaced with Form::deselectWidget(QWidget*)
    • bool FormManager::isTopLevel(QWidget*) moved to Form::isTopLevelWidget(QWidget*)
    • FormManager::selectedClass() removed
    • WidgetLibrary* FormManager::createWidgetLibrary(FormManager* m, const QStringList& supportedFactoryGroups) removed, WidgetLibrary is instantiated directly by KexiFormPart
    • FormManager::dirty(KFormDesigner::Form *form, bool isDirty = true) signal moved to Form::modified() signal
    • FormManager::showFormUICode() moved to KexiFormManager
    • FormManager::m_emitSelectionSignalsUpdatesPropertySet removed since we're not using windowChanged() (??)
    • void FormManager::setObjectTreeView(ObjectTreeView *treeview) moved to KexiFormManager::init()
  • WidgetPropertySet
    • removed, its code moved to Form
    • emitWidgetPropertyChanged() removed
  • Added #ifdef KFD_SIGSLOTS to disable code related to visual handling signal/slots connection
  • FormWidget
    • code moved to FormWidget.h and FormWidget.cpp
    • clearForm() removed (let's hopw QWidget update() is enough)
  • Commands:
    • Paste/Cut/Copy commands use QApplication::clipboard() now instead of FormManager::self()->m_domDoc, which has been removed
    • PropertyCommand::property() renamed to PropertyCommand::propertyName()
    • added operator<< for kDebug()
  • Container:
    • void setSelectedWidget(QWidget *selected, bool add, bool dontRaise = false, bool moreWillBeSelected = false) -> selectWidget(QWidget *w, Form::WidgetSelectionFlags flags = Form::DefaultWidgetSelectionFlags)
    • LayoutType enum moved to Form
    • setLayout() -> setLayoutType()
  • KexiFormPart
    • slotPropertyChanged() moved to Form::handleWidgetPropertyChanged(), so Form::widgetPropertyChanged() signal can be now removed
    • slotAutoTabStopsSet()'s code moved to Form::editTabOrder() itself
    • KexiFormPart::static_formsLibrary moved to KexiFormManger
    • slotWidgetCreatedByFormsLibrary(QWidget*) moved to KexiFormManger
    • WidgetLibrary* KexiFormPart::library() moved to KexiFormManager
    • assignAction() moved to KexiFormManager
  • KexiFormManger
    • added static self()
    • is initialized by KexiFormPart

2nd Phase

Jstaniek, 2009-04-25..2009-05-10

Status: DONE

  • WidgetFactory refactored
    • the main change is that we do not keep pointer to a currently handled container/widget/inline-editor in per-factory manner, this is kept per-form, so WidgetFactory::editor(), setEditor(), widget(), setWidget() have been removed
    • added:
      • InlineEditorCreationArgument class - arguments used by Form::createInlineEditor() and WidgetFactory::startInlineEditing()
    • renamed:
      • virtual bool startEditing(const QByteArray &classname, QWidget *w, Container *container) = 0 to virtual bool startInlineEditing(InlineEditorCreationArguments& args) = 0
      • resizeEditor() made public
      • virtual bool changeText(const QString &newText) renamed to virtual bool changeInlineText(Form *form, QWidget *widget, const QString& text);
      • void changeProperty(const char *name, const QVariant &value, Form *form) renamed to void changeProperty(Form *form, QWidget *widget, const char *name, const QVariant &value);
    • moved:
      • void createEditor(const QByteArray &classname, const QString &text, QWidget *w, Container *container, QRect geometry, Qt::Alignment alignment, bool useFrame = false, bool multiLine = false, Qt::BackgroundMode background = Qt::NoBackground) moved to void Form::createInlineEditor(const KFormDesigner::WidgetFactory::InlineEditorCreationArguments& args);
      • contents of disableFilter() moved to Form
      • eventFilter() moved to Form::eventFilter()
      • resetEditor() moved to Form::resetInlineEditor()
      • disableFilter() moved to Form::disableFilter()
      • changeInlineTextInternal() moved to Form::changeInlineTextInternal()
        • now uses InlineTextEditingCommand
      • inlineEditorDeleted() moved to
      • slotTextChanged() moved to Form::slotInlineTextChanged()
      • editorDeleted() moved to Form::editorDeleted()
      • widgetDestroyed() moved to Form::widgetDestroyed()
      • editorText() moved to Form::inlineEditorText()
      • setEditorText() moved to Form::setInlineEditorText()
      • m_editedWidgetClass moved to Form::Private::editedWidgetClass
      • m_firstText moved to Form::Private::originalInlineText
      • m_editor moved to Form::Private::inlineEditor
      • m_container moved to Form::Private::inlineEditorContainer;
    • removed:
      • void setEditor(QWidget *widget, QWidget *editor);
      • QWidget *editor(QWidget *widget) const;
      • void setWidget(QWidget *widget, Container *container);
      • QWidget *widget() const;
      • QPointer<ResizeHandleSet> m_handles;
      • QPointer<QWidget> m_widget;
  • ContainerFactory:
    • addTabPage() moved to internal AddTabAction, so context (container, widget) is no longer kept globally
    • similarly, renameTabPage() moved to internal RenameTabAction
    • similarly, removeTabPage() moved to internal RemoveTabAction
    • similarly, addStackPage() moved to internal AddStackPageAction
    • similarly, removeStackPage() moved to internal RemoveStackPageAction
    • similarly, nextStackPage() and prevStackPage() moved to internal GoToStackPageAction
  • ResizeHandleSet:
    • added Form* form() const
  • Commands:
  • use InlineTextEditingCommand in Form::changeInlineTextInternal() to get undo/redo functionality for inline editing
  • KexiDBFactory updated for the new API
  • ported code from void FormManager::initForm(Form *form) to KexiFormView::initForm()

3rd Phase

Jstaniek, 2010-09-01..

  • ObjectTreeView/ObjectTreeViewItem renamed to WidgetTreeWidget/WidgetTreeWidgetItem and ported to QTreeWidget/QTreeWidgetItem

Table View

Defects found:

  • [rshtemberko] Lines that separates column's names aren't in the same position as lines separating columns themselves [1]

Additional notes

  • Reimplement QWidget::showEvent(QEvent*) [virtual protected] instead of QWidget::show() [virtual public]. Also add if (!event->spontanous()) condition, as we're most often not interested in handling spontaneous events. Do the same for QWidget::hide()/QWidget::hideEvent(QEvent*).
    • Note: TODO in Kexi!
  • Use QRubberBand instead of painting using XOR
    • already used in KexiTableView and the query designer for drag indicators
    • TODO: use it in forms for displaying rectangles when inserting or resizing widgets

See also http://trolltech.com/developer/faqs/517/

Q3 Usage

Location Class Notes
formeditor/kexiactionselectiondialog.cpp #include <Q3Header> Needs to be rewritten - done
formeditor/factories/containerfactory.cpp #include <Q3ScrollView> Needs to be rewritten
formeditor/editlistviewdialog.cpp #include <q3header.h> File not compiled, to rewrite
formeditor/editlistviewdialog.cpp #include <Q3VBoxLayout> File not compiled, to rewrite
formeditor/editlistviewdialog.cpp #include <Q3HBoxLayout> File not compiled, to rewrite
kexiutils/debuggui.cpp #include <q3header.h> Needs to be rewritten
main/printing/ Unused, remove this dir done
main/startup/KexiStartupDialogTemplatesPage.cpp #include <Q3Header> Unused, remove this file done
main/startup/KexiStartupFileDialogBase_win.h #include <q3filedialog.h> Unused, remove this file done
plugins/forms/kexidbfactory.cpp //#include <q3scrollview.h> include not used, remove done
plugins/forms/kexidbfactorybase.cpp #include <q3scrollview.h> Needs to be rewritten
plugins/forms/widgets/kexidbdatetimeedit.h #include <q3datetimeedit.h> File not compiled, to rewrite
plugins/forms/widgets/kexidbtimeedit.h #include <q3datetimeedit.h> File not compiled, to rewrite
plugins/forms/widgets/kexidbsubform.cpp #include <Q3Frame> File not compiled, to rewrite
plugins/forms/widgets/kexidbsubform.h #include <q3scrollview.h> File not compiled, to rewrite
plugins/forms/widgets/kexidbdateedit.h #include <q3datetimeedit.h> File not compiled, to rewrite
plugins/importexport/csv/kexicsvimportdialog.cpp #include <q3table.h> Needs to be rewritten done
plugins/scripting/kexiscripting/kexiscriptdesignview.cpp #include <q3stylesheet.h> Needs to be rewritten
plugins/queries/kexiquerydesignersqlhistory.h #include <q3scrollview.h> Needs to be rewritten
plugins/queries/kexiquerydesignersql.cpp //Qt4#include <Q3SimpleRichText> Include not used, remove done
tests/widgets/kexidbdrivercombotest.cpp #include <Q3VBoxLayout> Needs to be rewritten
widget/pixmapcollection.h #include <q3intdict.h> File not compiled, to rewrite
widget/relations/KexiRelationsTableContainer_p.cpp #include <q3header.h> Needs to be rewritten (maybe in QGV?)
widget/relations/KexiRelationsScrollArea.cpp #include <q3header.h> Needs to be rewritten
widget/kexiscrollview.h #include <Q3ScrollView> Needs to be rewritten
widget/utils/kexirecordnavigator.cpp #include <Q3ScrollView> Needs to be rewritten
widget/utils/kexigradientwidget.h #include <Q3PtrList> File not compiled, remove done
widget/tableview/kexitimetableedit.cpp #include <q3datetimeedit.h> Include can be removed done
widget/tableview/kexitableedit.h #include <q3scrollview.h> Needs to be rewritten
widget/tableview/kexitableview.cpp #include <Q3WhatsThis> Needs to be rewritten
widget/tableview/kexitableviewheader.h #include <Q3Header> Needs to be rewritten
widget/tableview/kexitableview.h #include <Q3ScrollView> Needs to be rewritten
widget/tableview/kexitableview.h #include <q3header.h> Needs to be rewritten
widget/navigator/KexiProjectListView.cpp #include <q3header.h> Replaced with KexiProjectNavigator but formeditor/kexiactionselectiondialog.cpp still uses it; port kexiactionselectiondialog.cpp to KexiProjectNavigator, then KexiProjectListView* files can be removed - done
widget/kexiscrollview.cpp #include <Q3Frame> Include can be removed done

K3 Usage

Location Class Notes
formeditor/kexiactionselectiondialog_p.h #include <k3listview.h> Needs to be rewritten - done
formeditor/formIO.cpp #include <k3command.h> Needs to be rewritten
formeditor/editlistviewdialog.cpp #include <k3listview.h> File not compiled, to rewrite
formeditor/editlistviewdialog.cpp #include <k3listbox.h> File not compiled, to rewrite
kexiutils/debuggui.cpp #include <k3listview.h> Needs to be rewritten
main/startup/KexiStartupDialogTemplatesPage.h #include <k3listview.h> Remove
plugins/tables/kexitabledesignerview_p.h #include <K3Command> Rewritten (by piggz) done
plugins/tables/kexitabledesignercommands.h #include <k3command.h> Rewritten (by piggz) done
plugins/tables/kexitabledesignerview.cpp #include <k3command.h> Rewritten (by piggz) done
plugins/importexport/csv/kexicsvexportwizard.h #include <k3wizard.h> Needs to be rewritten (using the new Assistant GUI)
widget/pixmapcollection.h #include <k3iconview.h> File not compiled, to rewrite
widget/relations/KexiRelationsTableContainer_p.h #include <k3listview.h> Needs to be rewritten
widget/relations/KexiRelationsTableContainer.h #include <k3listview.h> Needs to be rewritten
widget/utils/klistviewitemtemplate.h #include <k3listview.h> Only used by KexiActionSelectionDialog, to rewrite - done
widget/navigator/KexiProjectListView.h #include <k3listview.h> Should be removed in favour of KexiProjectNavigator after porting KexiActionSelectionDialog to KexiProjectNavigator - done
widget/navigator/KexiProjectListView_p.h #include <K3ListView> Should be removed in favour of KexiProjectNavigator after porting KexiActionSelectionDialog to KexiProjectNavigator - done
widget/navigator/KexiProjectListView.cpp #include <k3listview.h> Should be removed in favour of KexiProjectNavigator after porting KexiActionSelectionDialog to KexiProjectNavigator - done
widget/navigator/KexiProjectListViewItem.h #include <k3listview.h> Should be removed in favour of KexiProjectNavigator after porting KexiActionSelectionDialog to KexiProjectNavigator - done

Qt3Support State (01-Sep-2012)

[email protected]:~/src/calligra/kexi> grep -R 'QT3\|q3\|k3' *

  • CMakeLists.txt: add_definitions(-DQT3_SUPPORT -DQT3_SUPPORT_WARNINGS)
  • formeditor/formIO.cpp:#include <k3command.h>
  • formeditor/factories/CMakeLists.txt: ${QT_QT3SUPPORT_LIBRARY}
  • formeditor/factories/CMakeLists.txt: ${QT_QT3SUPPORT_LIBRARY}
  • formeditor/editlistviewdialog.cpp:#include <q3header.h>
  • formeditor/editlistviewdialog.cpp:#include <k3listview.h>
  • formeditor/editlistviewdialog.cpp:#include <k3listbox.h>
  • kexiutils/debuggui.cpp:#include <q3header.h>
  • kexiutils/debuggui.cpp:#include <k3listview.h>
  • main/CMakeLists.txt: ${QT_QT3SUPPORT_LIBRARY}
  • main/startup/KexiStartupDialogTemplatesPage.h:#include <k3listview.h>
  • main/startup/KexiMainImportExportPage.ui: <include location="local">k3listview.h</include>
  • main/startup/KexiProjectStorageTypeSelectionPage.ui: <include location="local">k3listview.h</include>
  • plugins/forms/kexidbfactorybase.cpp:#include <q3scrollview.h>
  • plugins/forms/CMakeLists.txt: ${QT_QT3SUPPORT_LIBRARY}
  • plugins/forms/CMakeLists.txt: ${QT_QT3SUPPORT_LIBRARY}
  • plugins/forms/CMakeLists.txt: ${QT_QT3SUPPORT_LIBRARY}
  • plugins/forms/widgets/kexidbdatetimeedit.h:#include <q3datetimeedit.h>
  • plugins/forms/widgets/kexidbtimeedit.h:#include <q3datetimeedit.h>
  • plugins/forms/widgets/kexidbsubform.h:#include <q3scrollview.h>
  • plugins/forms/widgets/kexidbdateedit.h:#include <q3datetimeedit.h>
  • plugins/relations/CMakeLists.txt: ${QT_QT3SUPPORT_LIBRARY}
  • plugins/shapes/relationdesign/CMakeLists.txt:${QT_QT3SUPPORT_LIBRARY}
  • plugins/importexport/csv/kexicsvexportwizard.h:#include <k3wizard.h>
  • plugins/importexport/csv/CMakeLists.txt: ${QT_QT3SUPPORT_LIBRARY}
  • plugins/scripting/kexiscripting/kexiscriptdesignview.cpp:#include <q3stylesheet.h>
  • plugins/queries/kexiquerydesignersqlhistory.h:#include <q3scrollview.h>
  • plugins/queries/CMakeLists.txt: ${QT_QT3SUPPORT_LIBRARY}
  • widget/pixmapcollection.h:#include <q3intdict.h>
  • widget/pixmapcollection.h:#include <k3iconview.h>
  • widget/relations/KexiRelationsTableContainer_p.cpp:#include <q3header.h>
  • widget/relations/KexiRelationsTableContainer_p.h:#include <k3listview.h>
  • widget/relations/KexiRelationsTableContainer.h:#include <k3listview.h>
  • widget/relations/CMakeLists.txt: ${QT_QT3SUPPORT_LIBRARY}
  • widget/relations/KexiRelationsScrollArea.cpp:#include <q3header.h>
  • widget/dataviewcommon/CMakeLists.txt: ${QT_QT3SUPPORT_LIBRARY}
  • widget/utils/CMakeLists.txt: ${QT_QT3SUPPORT_LIBRARY}
  • widget/tableview/kexitableedit.h:#include <q3scrollview.h>
  • widget/tableview/kexitableview.h:#include <q3header.h>
  • widget/tableview/CMakeLists.txt: ${QT_QT3SUPPORT_LIBRARY}
  • widget/CMakeLists.txt: ${QT_QT3SUPPORT_LIBRARY}

This page was last edited on 28 February 2015, at 08:53. Content is available under Creative Commons License SA 4.0 unless otherwise noted.