[Qt-interest] Porting Qt 3 to Qt 4

Justin Noel justin at ics.com
Wed Sep 1 23:23:29 CEST 2010


On 09/01/2010 05:08 PM, Jake Colman wrote:
> We are finally porting from Qt 3.3.4 to Qt 4.6.3 and I am running into
> some issues.  Maybe others have dealt with these problems already?
>
> 1) What replaced the QCustomMenuItem class?  I am deriving from that
>     class but it no longer exists.
>    

Use QWidgetAction

> 2) What replaced QLineEdit::createPopupMenu()?  This method was
>     intended to be reimplemented if you need to create a custom popup
>     menu upon a right-click in the line edit.
>    

You have 3 options (All implemented in QWidget):

1) Implement contextMenuEvent(...). Use setContextMenuPolicy( 
Qt::DefaultContextMenu)

2) You can add actions to any QWidget. Use setContextMenuPolicy( 
Qt::ActionsContextMenu)

3) Connect to the customContextMenuRequested() signal. Use 
setContextMenuPolicy( Qt::CustomContextMen)

> 3) How do I get the style's default frame width?  I used to call
>     QStyle::defaultFrameWidth() but that method no longer exists.
>
>    

int frameWidth = style()->pixelMetric( QStyle::PM_DefaultFrameWidth, 
styleOptionPtr, widgetPtr);

I'll have to check the code for that particular metric, to see if it 
even checks anything in the options class, but you could probably pass 
it a bogus instance of QStyleOptionFrame.

Good Luck,
--Justin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100901/ce2ed18d/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: justin.vcf
Type: text/x-vcard
Size: 233 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100901/ce2ed18d/attachment.vcf 


More information about the Qt-interest-old mailing list