31 #include "ginteractor.h" 35 class _Internal_QLabel;
51 GLabel(
const string& text =
"",
const string& iconFileName =
"", QWidget* parent =
nullptr);
56 GLabel(
const string& text,
const QIcon& icon, QWidget* parent =
nullptr);
61 GLabel(
const string& text,
const QPixmap& icon, QWidget* parent =
nullptr);
91 string
getType()
const override;
103 void setBounds(
double x,
double y,
double width,
double height)
override;
112 void setColor(
const string& color)
override;
115 void setFont(
const QFont& font)
override;
118 void setFont(
const string& font)
override;
130 void setIcon(
const QIcon& icon)
override;
133 void setIcon(
const QPixmap& icon)
override;
136 void setIcon(
const string& filename,
bool retainIconSize =
true)
override;
142 virtual void setLabel(
const string& text);
148 void setSize(
double width,
double height)
override;
157 virtual void setText(
const string& text);
169 void setWidth(
double width)
override;
178 void setX(
double x)
override;
181 void setY(
double y)
override;
185 _Internal_QLabel* _iqlabel;
189 GText* getGText()
const;
190 bool hasGText()
const;
192 friend class _Internal_QLabel;
204 class _Internal_QLabel :
public QLabel,
public _Internal_QWidget {
208 _Internal_QLabel(
GLabel* glabel, QWidget* parent =
nullptr);
209 void detach()
override;
210 QSize sizeHint()
const override;
214 void doubleClicked();
217 void mouseDoubleClickEvent(QMouseEvent* e)
override;
218 void mousePressEvent(QMouseEvent* event)
override;
void setFont(const QFont &font) override
Sets the font used by this widget to the given Qt font.
Definition: glabel.cpp:152
void setVisible(bool visible) override
Returns true if the interactor is visible on the screen.
Definition: glabel.cpp:287
This struct contains real-valued width and height fields.
Definition: gtypes.h:39
_Internal_QWidget* getInternalWidget() const override
Returns a direct pointer to the internal Qt widget being wrapped by this interactor.
Definition: glabel.cpp:81
void setForeground(int rgb) override
Sets the foreground/text color of the interactor to the color represented by the given RGB integer...
Definition: glabel.cpp:166
void setSize(double width, double height) override
Sets the onscreen width and height of the interactor in pixels.
Definition: glabel.cpp:254
void setBounds(double x, double y, double width, double height) override
Sets the size and location of the widget.
Definition: glabel.cpp:124
string getType() const override
Returns a string representing the class name of this interactor, such as "GButton" or "GCheckBox"...
Definition: glabel.cpp:108
virtual void setLabel(string text)
Sets the text on the label to be the given text.
Definition: glabel.cpp:244
This graphical object subclass represents a text string.
Definition: gobjects.h:1442
virtual bool isWordWrap() const
Returns whether the label should wrap if its text is too long.
Definition: glabel.cpp:120
void setX(double x) override
Sets the onscreen x-coordinate of the top-left corner of the interactor relative to its window...
Definition: glabel.cpp:306
This abstract class is the superclass for all graphical interactors.
Definition: ginteractor.h:48
~GLabel() override
Frees memory allocated internally by the label.
Definition: glabel.cpp:64
virtual string getText() const
Returns the string displayed by the label.
Definition: glabel.cpp:89
void setColor(int rgb) override
Sets the foreground/text color of the interactor to the color represented by the given RGB integer...
Definition: glabel.cpp:138
void setLocation(double x, double y) override
Sets the onscreen x/y-coordinate of the top-left corner of the interactor relative to its window...
Definition: glabel.cpp:248
void setIcon(const QIcon &icon) override
Sets the icon associated with this interactor.
Definition: glabel.cpp:186
void setWidth(double width) override
Sets the onscreen width of the interactor in pixels.
Definition: glabel.cpp:294
GLabel(string text="", string iconFileName="", QWidget* parent=nullptr)
Creates a label with the specified text label and optional icon.
Definition: glabel.cpp:32
virtual string getLabel() const
Returns the string displayed by the label.
Definition: glabel.cpp:85
This class represents a graphics window that supports simple graphics.
Definition: gwindow.h:98
QWidget* getWidget() const override
Returns a direct pointer to the internal Qt widget being wrapped by this interactor.
Definition: glabel.cpp:112
virtual void setText(string text)
Sets the text on the label to be the given text.
Definition: glabel.cpp:266
void setY(double y) override
Sets the onscreen y-coordinate of the top-left corner of the interactor relative to its window...
Definition: glabel.cpp:312
virtual void setWordWrap(bool wrap)
Sets whether the label should wrap if its text is too long.
Definition: glabel.cpp:300
virtual GInteractor::TextPosition getTextPosition() const
Returns the label's text position relative to its icon.
Definition: glabel.cpp:93
This struct contains real-valued x, y, width, and height fields.
Definition: gtypes.h:289
virtual void setTextPosition(GInteractor::TextPosition position)
Sets the label's text position relative to its icon.
Definition: glabel.cpp:276
A GLabel represents a text string.
Definition: glabel.h:46
TextPosition
The places where an interactor can place its text relative to its icon.
Definition: ginteractor.h:53
void setHeight(double height) override
Sets the onscreen height of the interactor in pixels.
Definition: glabel.cpp:180