]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt2/README
Get rid of the static_casts.
[lyx.git] / src / frontends / qt2 / README
index 15716ea6670552ca36b1c0e5022931c0f4644b30..516cd5f996c078a05a4d19001663ef5ae328c9e1 100644 (file)
@@ -1,5 +1,43 @@
 This file contains some do's and dont's for the Qt2 frontend.
 
+General rules
+-------------
+
+Every editable field that affects the state of the dialog contents
+from LyX's point of view should connect its xxxChanged() signal to
+a the dialog's changed_adaptor() slot, which in turn should call
+form_->changed(). If you are using a more complicated thing anyway,
+then remember to call form_->changed() at the end (if it has changed !)
+Every non-trivial widget should have a tooltip. If you don't know
+what to write, write "FIXME", and it can fixed later. Don't be afraid
+to use QWhatsThis too, but this must be done in the derived class's
+constructor, and use _("..."). Non-trivial means that things like "OK"
+/must not/ have a tooltip.
+
+*DO NOT USE DESIGNER FROM Qt 3*. You must use a designer from Qt 2 to
+maintain compatibility.
+
+Remember to check tab order on a dialog (third icon, with blue bars in designer).
+Remember to check sensible resizing behaviour on a dialog.
+
+Remember to use Edit->Check Accelerators
+
+If necessary, you should override Qt2Base::isValid() for determining the validity
+of the current dialog's contents.
+OK/Apply/Restore/Close should be connected in the derived class's constructor
+to call form_->slotOK() etc. Refer to close/cancel as close in the source.
+Override update_contents() to update the dialog, not update(), and build_dialog(),
+not build(). Only these functions may change dialog widgets that may emit changed()
+during initialisation, to prevent the button controller from changing its state.
+
+Never call buttoncontroller functions directly from dialogs. In general, you
+should use Qt2Base::changed() in all circumstances. However, if you must call
+the buttoncontroller, make sure to respect Qt2Base::updating_
+
 Don't #undef emit - #include "QtLyXView.h" instead
  
 Naming conventions
@@ -17,43 +55,40 @@ Widgets should be named like "fooXX", where XX is one of the following
 widget types :
 
 CB - check box 
-CO -
-ED -
+CO - combo box
+ED - line edit
+LA - label
 ML -
 PB - push button
 (FIXME: complete this)
 
  
-Dialog         Maintainer      MVC conversion
-----------------------------------------------
-Bibitem
-Bibtex
-Character      Edwin
-Citation       Kalle           In progress
-Command
-Connections
-Copyright      Kalle           Done
-Credits                Kalle           In progress
-Document       Kalle           In progress (Not yet prepared)
-Error
-External
-File           Edwin
-Graphics
-Include
-Index          Kalle
-Log
-Minipage
-Paragraph      Edwin           Not yet prepared
-Preamble
-Preferences
-Print          Edwin
-Ref            Kalle
-Search         Edwin
-Splash         Edwin
-Tabular                                Not yet prepared
-TabularCreate  Edwin
-Toc            Kalle
-Url            Kalle
-VCLog
+Stuff to be aware of
+--------------------
+
+The connect statement in Qt is a macro and its arguments does not follow
+the C++ standard as it should. Using the construct "Type const &" as
+argument will lead to runtime-errors, use "const Type &" instead.
+
+ex.
+
+--right--
+
+       connect(list, SIGNAL(selected(const QString &)),
+               this, SLOT(complete_selected(const QString &)));
+
+--wrong--
+
+       connect(list, SIGNAL(selected(QString const &)),
+               this, SLOT(complete_selected(QString const &)));
+
+Qt, Unicode, and LyX
+--------------------
+
+LyX isn't unicoded yet. But you should follow these simple rules :
 
+o Use qt_() not _() in code
+o Use fromqstr and toqstr NOT .latin1() / .c_str()
 
+Using these functions (in qt_helpers.h) will make sure we use
+the right locale for converting to Qt's QString, which is unicode.