Problem using custom QWidget with the autorotate tool

Hi,

I was hoping to enhance the autorotate tool by implementing a custom widget
derived from QWidget so that I could update the button text of the start/stop
button. I am not sure if that is the optimal design now - press start and the
text becomes stop, press stop and the test becomes start.

I was also going to reset the values of the sliders when the reset button was
pressed but found the slot available for QSlider objects to do that. I was
thinking of adding another configuration option to set the frame rate as well
as setting the rotation speed based on mouse movements.

Whenever I tried to add a custom QWidget to the tool it failed to load. I
can’t figure out why and my approach looks nearly identical to the draw
tool’s. Is there something I am missing about plug ins? I have read the Qt
documentation and couldn’t spot a reason. I made an external set of source
files, autorotatesettings.h|cpp and added autorotatesettings.cpp to give
set(autorotatetool_SRCS autorotatetool.cpp autorotatesettings.cpp). Whenever
I link to it the tool fails to load - remove the autorotatesettings.cpp and
it loads again.

Right now I have a very minimal set of source files which I have attached for
the widget. I would like to add more but wanted to reduce it down to a
minimum in case it was some of my code.

I would really appreciate any pointers on this as I haven’t been able to
figure out what the problem is so far.

Thanks,

Marcus

On Jun 19, 2007, at 9:31 AM, Marcus D. Hanwell wrote:

I was hoping to enhance the autorotate tool by implementing a
custom widget
derived from QWidget so that I could update the button text of the
start/stop
button.

Do you need a custom QWidget? What if you simply call setText() on
the button?
http://doc.trolltech.com/4.3/qabstractbutton.html#text-prop

This seems like the best solution IMHO. Granted, I don’t know why a
custom QWidget would cause loading problems, but that’s a different
issue. :slight_smile:

Cheers,
-Geoff

On Tuesday 19 June 2007 16:13:39 Geoffrey Hutchison wrote:

On Jun 19, 2007, at 9:31 AM, Marcus D. Hanwell wrote:

I was hoping to enhance the autorotate tool by implementing a
custom widget
derived from QWidget so that I could update the button text of the
start/stop
button.

Do you need a custom QWidget? What if you simply call setText() on
the button?
http://doc.trolltech.com/4.3/qabstractbutton.html#text-prop

That is what I tried initially - saving the pointer to the button and calling
that. The pointer gets set to zero after widget creation though and then
cannot be accessed by the tool directly. There is not a setText() slot as
there is a setValue() slot for QSlider.

This seems like the best solution IMHO. Granted, I don’t know why a
custom QWidget would cause loading problems, but that’s a different
issue. :slight_smile:

That was what bugged me most - I can’t see why the tool would not load just
because it links to an almost empty class. As I find more features I would
like to implement it seems that an inherited QWidget would provide a good
solution but I can do most things the way I am currently.

Thanks for the suggestion.

Marcus

PS Someone asking about crystals on my last blog post - seems to have
generated a lot of interest :slight_smile:

I think you are doing something wrong, to subclass QWidget to call setText is
not very good idea. Why this pointer is set to zero?

On Tuesday 19 June 2007 16:13:39 Geoffrey Hutchison wrote:

On Jun 19, 2007, at 9:31 AM, Marcus D. Hanwell wrote:

I was hoping to enhance the autorotate tool by implementing a
custom widget
derived from QWidget so that I could update the button text of the
start/stop
button.

Do you need a custom QWidget? What if you simply call setText() on
the button?
http://doc.trolltech.com/4.3/qabstractbutton.html#text-prop

That is what I tried initially - saving the pointer to the button and
calling that. The pointer gets set to zero after widget creation though and
then cannot be accessed by the tool directly. There is not a setText() slot
as there is a setValue() slot for QSlider.

This seems like the best solution IMHO. Granted, I don’t know why a
custom QWidget would cause loading problems, but that’s a different
issue. :slight_smile:

That was what bugged me most - I can’t see why the tool would not load
just because it links to an almost empty class. As I find more features I
would like to implement it seems that an inherited QWidget would provide a
good solution but I can do most things the way I am currently.

Thanks for the suggestion.

Marcus

PS Someone asking about crystals on my last blog post - seems to have
generated a lot of interest :slight_smile:


This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/


Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/avogadro-devel