1 /**************************************************************************** 2 ** 3 ** DQt - D bindings for the Qt Toolkit 4 ** 5 ** GNU Lesser General Public License Usage 6 ** This file may be used under the terms of the GNU Lesser 7 ** General Public License version 3 as published by the Free Software 8 ** Foundation and appearing in the file LICENSE.LGPL3 included in the 9 ** packaging of this file. Please review the following information to 10 ** ensure the GNU Lesser General Public License version 3 requirements 11 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 12 ** 13 ****************************************************************************/ 14 module qt.widgets.label; 15 extern(C++): 16 17 import qt.config; 18 import qt.core.coreevent; 19 import qt.core.namespace; 20 import qt.core.size; 21 import qt.core.string; 22 import qt.gui.event; 23 import qt.gui.movie; 24 import qt.gui.pixmap; 25 import qt.helpers; 26 import qt.widgets.frame; 27 import qt.widgets.widget; 28 version(QT_NO_PICTURE){}else 29 import qt.gui.picture; 30 31 /+ QT_REQUIRE_CONFIG(label); +/ 32 33 34 35 extern(C++, class) struct QLabelPrivate; 36 37 class /+ Q_WIDGETS_EXPORT +/ QLabel : QFrame 38 { 39 mixin(Q_OBJECT); 40 /+ Q_PROPERTY(QString text READ text WRITE setText) 41 Q_PROPERTY(Qt::TextFormat textFormat READ textFormat WRITE setTextFormat) 42 Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap) 43 Q_PROPERTY(bool scaledContents READ hasScaledContents WRITE setScaledContents) 44 Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) 45 Q_PROPERTY(bool wordWrap READ wordWrap WRITE setWordWrap) 46 Q_PROPERTY(int margin READ margin WRITE setMargin) 47 Q_PROPERTY(int indent READ indent WRITE setIndent) 48 Q_PROPERTY(bool openExternalLinks READ openExternalLinks WRITE setOpenExternalLinks) 49 Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags) 50 Q_PROPERTY(bool hasSelectedText READ hasSelectedText) 51 Q_PROPERTY(QString selectedText READ selectedText) +/ 52 53 public: 54 /+ explicit +/this(QWidget parent=null, /+ Qt:: +/qt.core.namespace.WindowFlags f=/+ Qt:: +/qt.core.namespace.WindowFlags()); 55 /+ explicit +/this(ref const(QString) text, QWidget parent=null, /+ Qt:: +/qt.core.namespace.WindowFlags f=/+ Qt:: +/qt.core.namespace.WindowFlags()); 56 ~this(); 57 58 final QString text() const; 59 60 /+ #if QT_DEPRECATED_SINCE(5,15) +/ 61 /+ QT_DEPRECATED_VERSION_X(5, 15, "Use the other overload which returns QPixmap by-value") +/ 62 final const(QPixmap)* pixmap() const; // ### Qt 7: Remove function 63 64 final QPixmap pixmap(/+ Qt:: +/qt.core.namespace.ReturnByValueConstant) const; 65 /+ #else 66 QPixmap pixmap(Qt::ReturnByValueConstant = Qt::ReturnByValue) const; // ### Qt 7: Remove arg 67 #endif // QT_DEPRECATED_SINCE(5,15) 68 69 #ifndef QT_NO_PICTURE 70 # if QT_DEPRECATED_SINCE(5,15) +/ 71 version(QT_NO_PICTURE){}else 72 { 73 /+ QT_DEPRECATED_VERSION_X(5, 15, "Use the other overload which returns QPicture by-value") +/ 74 final const(QPicture)* picture() const; // ### Qt 7: Remove function 75 76 // final QPicture picture(/+ Qt:: +/qt.core.namespace.ReturnByValueConstant) const; 77 } 78 /+ # else 79 QPicture picture(Qt::ReturnByValueConstant = Qt::ReturnByValue) const; // ### Qt 7: Remove arg 80 # endif // QT_DEPRECATED_SINCE(5,15) 81 #endif 82 #if QT_CONFIG(movie) +/ 83 final QMovie movie() const; 84 /+ #endif +/ 85 86 final /+ Qt:: +/qt.core.namespace.TextFormat textFormat() const; 87 final void setTextFormat(/+ Qt:: +/qt.core.namespace.TextFormat); 88 89 final /+ Qt:: +/qt.core.namespace.Alignment alignment() const; 90 final void setAlignment(/+ Qt:: +/qt.core.namespace.Alignment); 91 92 final void setWordWrap(bool on); 93 final bool wordWrap() const; 94 95 final int indent() const; 96 final void setIndent(int); 97 98 final int margin() const; 99 final void setMargin(int); 100 101 final bool hasScaledContents() const; 102 final void setScaledContents(bool); 103 override QSize sizeHint() const; 104 override QSize minimumSizeHint() const; 105 version(QT_NO_SHORTCUT){}else 106 { 107 final void setBuddy(QWidget ); 108 final QWidget buddy() const; 109 } 110 override int heightForWidth(int) const; 111 112 final bool openExternalLinks() const; 113 final void setOpenExternalLinks(bool open); 114 115 final void setTextInteractionFlags(/+ Qt:: +/qt.core.namespace.TextInteractionFlags flags); 116 final /+ Qt:: +/qt.core.namespace.TextInteractionFlags textInteractionFlags() const; 117 118 final void setSelection(int, int); 119 final bool hasSelectedText() const; 120 final QString selectedText() const; 121 final int selectionStart() const; 122 123 public /+ Q_SLOTS +/: 124 @QSlot final void setText(ref const(QString) ); 125 final void setText(const QString s){setText(s);} 126 @QSlot final void setPixmap(ref const(QPixmap) ); 127 /+ #ifndef QT_NO_PICTURE +/ 128 version(QT_NO_PICTURE){}else 129 { 130 @QSlot final void setPicture(ref const(QPicture) ); 131 } 132 /+ #endif 133 #if QT_CONFIG(movie) +/ 134 @QSlot final void setMovie(QMovie movie); 135 /+ #endif +/ 136 @QSlot final void setNum(int); 137 @QSlot final void setNum(double); 138 @QSlot final void clear(); 139 140 /+ Q_SIGNALS +/public: 141 @QSignal final void linkActivated(ref const(QString) link); 142 @QSignal final void linkHovered(ref const(QString) link); 143 144 protected: 145 override bool event(QEvent e); 146 override void keyPressEvent(QKeyEvent ev); 147 override void paintEvent(QPaintEvent ); 148 override void changeEvent(QEvent ); 149 override void mousePressEvent(QMouseEvent ev); 150 override void mouseMoveEvent(QMouseEvent ev); 151 override void mouseReleaseEvent(QMouseEvent ev); 152 version(QT_NO_CONTEXTMENU){}else 153 { 154 override void contextMenuEvent(QContextMenuEvent ev); 155 } 156 override void focusInEvent(QFocusEvent ev); 157 override void focusOutEvent(QFocusEvent ev); 158 override bool focusNextPrevChild(bool next); 159 160 161 private: 162 /+ Q_DISABLE_COPY(QLabel) +/ 163 /+ Q_DECLARE_PRIVATE(QLabel) +/ 164 /+ #if QT_CONFIG(movie) 165 Q_PRIVATE_SLOT(d_func(), void _q_movieUpdated(const QRect&)) 166 Q_PRIVATE_SLOT(d_func(), void _q_movieResized(const QSize&)) 167 #endif 168 Q_PRIVATE_SLOT(d_func(), void _q_linkHovered(const QString &)) 169 170 #ifndef QT_NO_SHORTCUT 171 Q_PRIVATE_SLOT(d_func(), void _q_buddyDeleted()) 172 #endif +/ 173 /+ friend class QTipLabel; +/ 174 /+ friend class QMessageBoxPrivate; +/ 175 /+ friend class QBalloonTip; +/ 176 } 177