How to adjust applet size according to its child QGraphicsWidget?

Dong Tiger idlecat511 at gmail.com
Wed Feb 25 11:05:52 CET 2009


2008/12/30 Alexis Ménard <menard at kde.org>

> Unfortunately you can't it is a bug in Qt.
>
> You can take a look to the task tracker of Qt Number 231114 and 211500. I
> guess it is what you try to solve. The fix is in 4.4 branch (so scheduled
> for 4.4.4) and in 4.5.


I still can't get this work even with latest Qt4.5. I've attached code of a
sample plasmoid which demonstrate the problem. You are welcomed to try it
out. Right click on the applet to modify its child widget size.


>
>
> As a workaround you have to manage the resize of your applet by hand when
> the size of the layout change.
>
The question is how can I do it? When the embedded QGraphicsWidget need to
enlarge, say from 200x200 to 400x400, how can I decide what the applet size
should be?


>
> 2008/12/30 Dong Tiger <idlecat511 at gmail.com>
>
>> Hi,
>>
>> A QGraphicsWidget is embeded into Plasma::Applet through
>> QGraphicsLinearLayout. When this QGraphicsWidget's size changes, how to get
>> the applet's size adjusted accordingly?
>>
>> The code snippet looks like:
>>
>>   child = new MyGraphicsWidget(applet);
>>   layout = new QGraphicsLinearLayout(applet);
>>   layout->setSpacing(0);
>>   layout->addItem(child);
>>   applet->setLayout(layout);
>>
>>
>> Regards,
>> --
>> Tiger
>>
>> _______________________________________________
>> Plasma-devel mailing list
>> Plasma-devel at kde.org
>> https://mail.kde.org/mailman/listinfo/plasma-devel
>>
>>
>
> _______________________________________________
> Plasma-devel mailing list
> Plasma-devel at kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/plasma-devel/attachments/20090225/4693344f/attachment-0001.htm 
-------------- next part --------------
# Project Needs a name ofcourse
project(plasma-tutorial1)
 
# Find the required Libaries
find_package(Qt4 REQUIRED)
find_package(KDE4 REQUIRED)
include(KDE4Defaults)
 
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
include_directories(
   ${CMAKE_SOURCE_DIR}
   ${CMAKE_BINARY_DIR}
   ${KDE4_INCLUDES}
   ${Qt4_INCLUDES}}
   )
 
# We add our source code here
set(tutorial1_SRCS plasma-tutorial1.cpp)
 
# Now make sure all files get to the right place
kde4_add_plugin(plasma_applet_tutorial1 ${tutorial1_SRCS})
target_link_libraries(plasma_applet_tutorial1 
                      ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS} ${Qt4_LIBS})
 
install(TARGETS plasma_applet_tutorial1
        DESTINATION ${PLUGIN_INSTALL_DIR})
 
install(FILES plasma-applet-tutorial1.desktop
        DESTINATION ${SERVICES_INSTALL_DIR})
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plasma-tutorial1.cpp
Type: text/x-c++src
Size: 2354 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20090225/4693344f/attachment-0001.cpp 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plasma-tutorial1.h
Type: text/x-chdr
Size: 1035 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20090225/4693344f/attachment-0001.h 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plasma-applet-tutorial1.desktop
Type: application/octet-stream
Size: 473 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20090225/4693344f/attachment-0001.dll 


More information about the Plasma-devel mailing list