[KPhotoAlbum] Description for HTML-export themes (info needed)

Tuomas Suutari tuomas.suutari at gmail.com
Sat Jan 14 20:45:58 GMT 2012


Hi!

On 14 January 2012 19:37, Steffen Jost <steffenjost at web.de> wrote:
> Hi! I am trying to add a description field to the HTML-export themes, which
> is displayed in the corresponding HTML-export dialog tab, in response to the
> message cited below.

Great! It's always nice to see new contributers! :)

> Could someone briefly explain the following compiler error message:
>
>        kphotoalbum/HTMLGenerator/HTMLDialog.h:73:5: error: ‘QLabel’ does not
> name a type

You need to include <QLabel> if it's not already included, i.e. add
"#include <QLabel>" line with the other includes in the top of the
HTMLDialog.h file.

(Or you can just "forward declare" it, if you don't use the concrete
type but just a pointer or reference to the type. Forward declaration
goes like "class QLabel;" and it's usually placed near the includes
too... It's quite long story to explain the difference. Google
"forward declaration" if you're interested.)

> I inserted the following line at 73 in HTMLDialog.h
>        QLabel* _themeDescription;

Don't forget to create the label too (with new QLabel), in
HTMLDialog.cpp. (And if you used forward declaration in the h file,
then you need to include <QLabel> now in the cpp file for this. Though
if there already is a QLabel, it should be already included.)

> but I do not understand why QLabel "does not name a type"? I cannot see a
> difference in the QLabel class description at
>        http://doc.trolltech.com/3.3/qlabel.html

KPhotoAlbum these days uses Qt 4, so you should use newer Qt
documentation. Qt has changed quite a bit between the 3.x and 4.x
versions. Try http://developer.qt.nokia.com/doc/qt-4.8/qlabel.html
instead.

> compared to, say, QComboBox as used in the preexisting line 72
>        QComboBox* _themeBox;
>
> I never used Qt nor C++; but I do have experience in several other
> programming languages (I work as theoretical computer scientist) and I did
> start to read the Qt tutorials now. Nevertheless I would appreciate some
> guidance to speed things up.
>
> _I do have a plan though:_
>
>        I connected the _themeBox's (an instance of QComboBox)
> SIGNAL(currentIndexChanged( int )) to a new slot added to HTMLDialog. This
> slot then updates a QLabel added in the theme selection tab of that dialog.

>        I am not sure whether QLabel is the correct thing to just display
> text,

It is.

> but in the third tab it is used to display a "Hint"-message, so from
> that I guessed that it would do, since it also offers a slot for changing
> the text.
>        Howewer, I need to map the theme number from the QComboBox to the
> text. So in order to do this, I need the QLabel to be private field in
> HTMLDialog, as well as a small string array holding the descriptions that
> were read during the initialization (more specific in the loop within method
> populateThemesCombo).

You can use QStringList for storing the descriptions for each number.

Hope that helps!

-- 
Tuomas



More information about the Kphotoalbum mailing list