This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Wallpaper Tutorial - config was not declared in this scope ?

Tags: None
(comma "," separated)
User avatar
DJ Barney
Registered Member
Posts
6
Karma
0
OS
Hello,

I've been away from KDE since 2003. But now I'm back and want to develop a few wallpaper plugins. I compiled the first wallpaper tutorial OK and had it running on my desktop. However I'm having trouble compiling the second tutorial. I have looked through every file very carefully and tried adjusting a few things to fix these errors.

Code: Select all
barney@anubis-ubuntu ~/DJ_Barney_Docs/Forge/SourceForge/KDE Plasma Desktop/plasma-wallpaper-tutorial/build
$ make
Generating tutorial.moc
[  0%] Built target plasma_wallpaper_tutorial_automoc                                                                           
[ 33%] Building CXX object CMakeFiles/plasma_wallpaper_tutorial.dir/tutorial.cpp.o
/home/barney/DJ_Barney_Docs/Forge/SourceForge/KDE Plasma Desktop/plasma-wallpaper-tutorial/tutorial.cpp:10:6: warning: unused parameter ‘exposedRect’
/home/barney/DJ_Barney_Docs/Forge/SourceForge/KDE Plasma Desktop/plasma-wallpaper-tutorial/tutorial.cpp: In member function ‘virtual QWidget* Tutorial::createConfigurationInterface(QWidget*)’:
/home/barney/DJ_Barney_Docs/Forge/SourceForge/KDE Plasma Desktop/plasma-wallpaper-tutorial/tutorial.cpp:42:5: error: ‘config’ was not declared in this scope
/home/barney/DJ_Barney_Docs/Forge/SourceForge/KDE Plasma Desktop/plasma-wallpaper-tutorial/tutorial.cpp: In member function ‘void Tutorial::settingsModified()’:
/home/barney/DJ_Barney_Docs/Forge/SourceForge/KDE Plasma Desktop/plasma-wallpaper-tutorial/tutorial.cpp:61:18: error: ‘config’ was not declared in this scope
make[2]: *** [CMakeFiles/plasma_wallpaper_tutorial.dir/tutorial.cpp.o] Error 1
make[1]: *** [CMakeFiles/plasma_wallpaper_tutorial.dir/all] Error 2
make: *** [all] Error 2


There are a couple of functions that don't give the "‘config’ was not declared in this scope" error that have the kconfig declaration. I have tried putting this in createConfigurationInterface function but it makes no difference. Here are the other files.

config.ui

CMakeLists.txt

tutorial.h

tutorial.cpp

What am I doing wrong ? I'm 99% sure I've followed the tutorial to the letter.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
The problem here is that your *.ui file is not included in the Tutorial class, and isn't loaded into the tutorial.h file.

To do this, edit tutorial.h:
Add to the top:
Code: Select all
#include "ui_config.h"


And to your private variables:
Code: Select all
Ui::Config configWidget;


Then edit tutorial.cpp, and change all references to config.* to configWidget.* in Tutorial::createConfigurationInterface.

Leave the other functions unchanged, they are fine.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
DJ Barney
Registered Member
Posts
6
Karma
0
OS
Thanks. That compiles now. I wonder if the tutorial needs adjusting ? I guess it might have been left like that to make the pupil think a bit.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
The tutorial may need adjusting, yes. As Techbase is a wiki, please feel free to work on and improve the tutorials as you go through them.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
DJ Barney
Registered Member
Posts
6
Karma
0
OS
I added a link to this thread in the tutorial.
jboss1995
Registered Member
Posts
15
Karma
0
Is it possibly to use OpenGL?

If you have to use the Plasma::Wallpaper
Ocean::Ocean(QObject *parent, const QVariantList &args) : Plasma::Wallpaper(parent, args)

How can I create QGLWidget?
Ocean::Ocean(QWidget *parent) : QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Unfortunately Plasma::Wallpaper provides you with very limited access - and this excludes use of OpenGL as you are required to use QPainter to paint the Wallpaper. You might want to ask on the Plasma Development mailing list (plasma-devel@kde.org) though.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot]