[Qt] V1.40 and other problems
Павел Ишенин
webpirat at mail.ru
Fri Jul 6 01:44:11 CEST 2007
Den Jean wrote:
> On Thursday 05 July 2007 12:28:53 pm Павел Ишенин wrote:
>
>> Second problem are still with QStyleOptions. I need some way to set
>> variables of that class (I really dont know what is the variables of
>> class and how they differ from properties).
>>
>
> http://www.lazarus.freepascal.org/pipermail/qt/2007-June/000309.html
>
> I already answered how and asked for sample code to test the typecasting.
> This is an enormous work: manually translate C structs into binary
> equivalent pascal record types. I would start with the ones you plan to use.
>
>
Sorry, I have no non LCL program to test. I even dont know how to do it,
but I will try.
> I also asked some code to see what you are up to. Do you realize that some
> stuff needs method overriding (no events available). Will you need method overriding of QStyle?
>
I dont know without working example, but I suppose that yes.
> Currently the binding does not support this in general (automatically generate this).
> For stuff like this a manually created class can be incorporated.
> But again, what are you up to, what do you need?
>
> There are 22 virtual methods to override. Any priorities :-)
>
> grep -i virtual src/gui/styles/qstyle.h
> virtual ~QStyle();
> virtual void polish(QWidget *);
> virtual void unpolish(QWidget *);
> virtual void polish(QApplication *);
> virtual void unpolish(QApplication *);
> virtual void polish(QPalette &);
> virtual QRect itemTextRect(const QFontMetrics &fm, const QRect &r,
> virtual QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const;
> virtual void drawItemText(QPainter *painter, const QRect &rect,
> virtual void drawItemPixmap(QPainter *painter, const QRect &rect,
> virtual QPalette standardPalette() const;
> virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p,
> virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p,
> virtual QRect subElementRect(SubElement subElement, const QStyleOption *option,
> virtual void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p,
> virtual SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt,
> virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
> virtual int pixelMetric(PixelMetric metric, const QStyleOption *option = 0,
> virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt,
> virtual int styleHint(StyleHint stylehint, const QStyleOption *opt = 0,
> virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt = 0,
> virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
>
Priorities are:
drawControl
drawComplexControl
drawPrimitive
drawItemText
> And I already copied the definitions of C structs (the non method part of the classes)
> in preparation of the manual translation.
> Any priorities ?
>
> class Q_GUI_EXPORT QStyleOption
> int version;
> int type;
> QStyle::State state;
> Qt::LayoutDirection direction;
> QRect rect;
> QFontMetrics fontMetrics;
> QPalette palette;
> class Q_GUI_EXPORT QStyleOptionFocusRect : public QStyleOption
> QColor backgroundColor;
> class Q_GUI_EXPORT QStyleOptionFrame : public QStyleOption
> int lineWidth;
> int midLineWidth;
> class Q_GUI_EXPORT QStyleOptionFrameV2 : public QStyleOptionFrame
> FrameFeatures features;
> class Q_GUI_EXPORT QStyleOptionTabWidgetFrame : public QStyleOption
> int lineWidth;
> int midLineWidth;
> QTabBar::Shape shape;
> QSize tabBarSize;
> QSize rightCornerWidgetSize;
> QSize leftCornerWidgetSize;
> class Q_GUI_EXPORT QStyleOptionTabBarBase : public QStyleOption
> QTabBar::Shape shape;
> QRect tabBarRect;
> QRect selectedTabRect;
> class Q_GUI_EXPORT QStyleOptionHeader : public QStyleOption
> int section;
> QString text;
> Qt::Alignment textAlignment;
> QIcon icon;
> Qt::Alignment iconAlignment;
> SectionPosition position;
> SelectedPosition selectedPosition;
> SortIndicator sortIndicator;
> Qt::Orientation orientation;
> class Q_GUI_EXPORT QStyleOptionButton : public QStyleOption
> ButtonFeatures features;
> QString text;
> QIcon icon;
> QSize iconSize;
> class Q_GUI_EXPORT QStyleOptionTab : public QStyleOption
> QTabBar::Shape shape;
> QString text;
> QIcon icon;
> int row;
> TabPosition position;
> SelectedPosition selectedPosition;
> CornerWidgets cornerWidgets;
> class Q_GUI_EXPORT QStyleOptionTabV2 : public QStyleOptionTab
> QSize iconSize;
> class Q_GUI_EXPORT QStyleOptionToolBar : public QStyleOption
> ToolBarPosition positionOfLine; // The toolbar line position
> ToolBarPosition positionWithinLine; // The position within a toolbar
> Qt::ToolBarArea toolBarArea; // The toolbar docking area
> ToolBarFeatures features;
> int lineWidth;
> int midLineWidth;
> class Q_GUI_EXPORT QStyleOptionProgressBar : public QStyleOption
> int minimum;
> int maximum;
> int progress;
> QString text;
> Qt::Alignment textAlignment;
> bool textVisible;
> class Q_GUI_EXPORT QStyleOptionProgressBarV2 : public QStyleOptionProgressBar
> Qt::Orientation orientation;
> bool invertedAppearance;
> bool bottomToTop;
> class Q_GUI_EXPORT QStyleOptionMenuItem : public QStyleOption
> MenuItemType menuItemType;
> CheckType checkType;
> bool checked;
> bool menuHasCheckableItems;
> QRect menuRect;
> QString text;
> QIcon icon;
> int maxIconWidth;
> int tabWidth;
> QFont font;
> class Q_GUI_EXPORT QStyleOptionQ3ListViewItem : public QStyleOption
> Q3ListViewItemFeatures features;
> int height;
> int totalHeight;
> int itemY;
> int childCount;
> class Q_GUI_EXPORT QStyleOptionQ3DockWindow : public QStyleOption
> bool docked;
> bool closeEnabled;
> class Q_GUI_EXPORT QStyleOptionDockWidget : public QStyleOption
> QString title;
> bool closable;
> bool movable;
> bool floatable;
> class Q_GUI_EXPORT QStyleOptionDockWidgetV2 : public QStyleOptionDockWidget
> bool verticalTitleBar;
> class Q_GUI_EXPORT QStyleOptionViewItem : public QStyleOption
> Qt::Alignment displayAlignment;
> Qt::Alignment decorationAlignment;
> Qt::TextElideMode textElideMode;
> Position decorationPosition;
> QSize decorationSize;
> QFont font;
> bool showDecorationSelected;
> class Q_GUI_EXPORT QStyleOptionViewItemV2 : public QStyleOptionViewItem
> ViewItemFeatures features;
> class Q_GUI_EXPORT QStyleOptionViewItemV3 : public QStyleOptionViewItemV2
> QLocale locale;
> const QWidget *widget;
> class Q_GUI_EXPORT QStyleOptionToolBox : public QStyleOption
> QString text;
> QIcon icon;
> class Q_GUI_EXPORT QStyleOptionToolBoxV2 : public QStyleOptionToolBox
> TabPosition position;
> SelectedPosition selectedPosition;
> class Q_GUI_EXPORT QStyleOptionRubberBand : public QStyleOption
> QRubberBand::Shape shape;
> bool opaque;
> class Q_GUI_EXPORT QStyleOptionComplex : public QStyleOption
> QStyle::SubControls subControls;
> QStyle::SubControls activeSubControls;
> class Q_GUI_EXPORT QStyleOptionSlider : public QStyleOptionComplex
> Qt::Orientation orientation;
> int minimum;
> int maximum;
> QSlider::TickPosition tickPosition;
> int tickInterval;
> bool upsideDown;
> int sliderPosition;
> int sliderValue;
> int singleStep;
> int pageStep;
> qreal notchTarget;
> bool dialWrapping;
> class Q_GUI_EXPORT QStyleOptionSpinBox : public QStyleOptionComplex
> QAbstractSpinBox::ButtonSymbols buttonSymbols;
> QAbstractSpinBox::StepEnabled stepEnabled;
> bool frame;
> class Q_GUI_EXPORT QStyleOptionQ3ListView : public QStyleOptionComplex
> QList<QStyleOptionQ3ListViewItem> items;
> QPalette viewportPalette;
> QPalette::ColorRole viewportBGRole;
> int sortColumn;
> int itemMargin;
> int treeStepSize;
> bool rootIsDecorated;
> class Q_GUI_EXPORT QStyleOptionToolButton : public QStyleOptionComplex
> ToolButtonFeatures features;
> QIcon icon;
> QSize iconSize;
> QString text;
> Qt::ArrowType arrowType;
> Qt::ToolButtonStyle toolButtonStyle;
> QPoint pos;
> QFont font;
> class Q_GUI_EXPORT QStyleOptionComboBox : public QStyleOptionComplex
> bool editable;
> QRect popupRect;
> bool frame;
> QString currentText;
> QIcon currentIcon;
> QSize iconSize;
> class Q_GUI_EXPORT QStyleOptionTitleBar : public QStyleOptionComplex
> QString text;
> QIcon icon;
> int titleBarState;
> Qt::WindowFlags titleBarFlags;
> class Q_GUI_EXPORT QStyleOptionGroupBox : public QStyleOptionComplex
> QStyleOptionFrameV2::FrameFeatures features;
> QString text;
> Qt::Alignment textAlignment;
> QColor textColor;
> int lineWidth;
> int midLineWidth;
> class Q_GUI_EXPORT QStyleOptionSizeGrip : public QStyleOptionComplex
> Qt::Corner corner;
> class Q_GUI_EXPORT QStyleOptionGraphicsItem : public QStyleOption
> QRectF exposedRect;
> QMatrix matrix;
> qreal levelOfDetail;
> class Q_GUI_EXPORT QStyleHintReturn {
> int version;
> int type;
> class Q_GUI_EXPORT QStyleHintReturnMask : public QStyleHintReturn {
> QRegion region;
> class Q_GUI_EXPORT QStyleHintReturnVariant : public QStyleHintReturn {
> QVariant variant;
>
>
Priorities are:
QStyleOption:
int version;
QStyle::State state;
QRect rect;
QStyleOptionButton:
ButtonFeatures features;
I have no non-LCL test as I said, but you can look at how code will be
used. I already commited unit to lazarus svn: lcl\interfaces\qt\qtthemes.pas
Best regards,
Paul Ishenin.
More information about the Qt
mailing list