A toolbutton with an arrow icon that is nicer than the Qt arrow button. type should be one of Qt::UpArrow, Qt::DownArrow, Qt::LeftArrow, Qt::RightArrow. name defaults to 0 and is now irrelevant. To use this class, you must have the four arrow.png files in a directory named images under the top directory of your project, and they must be included in a resource file, as in 3dmod and midas.
This class provides a color selector with a sample color panel, and three
sliders for adjusting red, green, and blue. label is used to set a
label at the top of the panel, and the color is initialized with red,
green, and blue. It manages the color of the
panel continuously during changes, and emits a signal for a new color
if the slider is clicked. It will also emit signals during a drag if
hotFlag is not 2; if the key given by hotKey is up when hotFlag is 0;
or if that key is down when hotFlag is 1. name defaults to NULL, and
the window flags default to Qt::WDestructiveClose | Qt::WType_TopLevel.
Signals emitted are:
void newColor(int r, int g, int b); - When the color changes
void done(); - When the Done button is pressed
void closing(); - When the window is closing
void keyPress(QKeyEvent *e); - When a key is pressed
void keyRelease(QKeyEvent *e); - When a key is released
In addition, there is one method:
bool hotSliding(); - Returns true is a slider is being dragged
DialogFrame provides a widget whose default style is to be a dialog box that
destroys itself on closing. Its main area is a QVBoxLayout, protected
member mLayout, that can be populated with widgets by the inheriting
class. The bottom row(s) will have numButton buttons, with text given in
labels. Tooltips for each button can be provided in tips if it is
non-NULL. The buttons will be equally sized if equalSized is true;
otherwise they will all be just big enough for their respective text.
Set numButtons to 0 to have no buttons. The
window title will be set to caption, or to fallback if caption is
NULL. name defaults to 0, fl defaults to Qt::Window.
The class emits two signals: actionPressed(int which) and
actionClicked(int which)
with the argument providing the number of the button pressed or clicked.
This alternate constructor includes numRows to specify the number of rows, and rounded to indicate that the style has rounded buttons. Other items are as above.
A virtual protected function that maintains the size of the buttons upon font change. If the inheriting class reimplements this, it should first update the mRoundedStyle variable, then call DialogFrame::changeEvent(e), then set its font-dependent sizes
This class provides an arbitrary number of horizontal sliders, each with
a label and an integer numeric output that is managed as the slider is
dragged. The number of sliders is set in numSliders, their text labels
in titles. Overall minimal and maximum values and number of decimal
places can be set with minVal (default 0), maxVal (default 255), and
decimals (default 0). The page step and single step size of each slider
is set to 1. Set horizontal flag to true to have the sliders
arranged in a QHBoxLayout instead of a QVBoxLayout. The layout can be
obtained with:
QBoxLayout *getLayout();
As a slider value changes, the class emits a signal:
void sliderChanged(int slider, int value, bool dragging);
with slider equal to the slider number, value with the new integer
value, and dragging true if the slider is being dragged.
Sets the number of decimals to display for the given slider number to decimals.
Sets a scaling to divide integer slider values by to get the number to display. When no scaling is set and decimals are specified, slider values are divided by 10 to the number of decimals, and single steps correspond to single digit changes. Scaling can be used to make single steps produce intermediate changes like 0.002.
Sets the value of the given slider to value with signals blocked.
Sets the range of the given slider to minVal, maxVal with signals blocked.
Sets the range of the given slider to minVal, maxVal and the value to value with signals blocked, thus avoiding any signals from an existing value being outside of a new range.
Returns a pointer to the given slider, or NULL if the value is out of range.
Sets the enable state of given slider and its associated text fields to enabled.
Shows or hides a given slider and its associated text fields depending on the value of show.
A line edit widget that sends a signal, focusLost(), when it loses input focus, and that can be set to fixed column width by providing the number of characters in columns. columns defaults to 0. name is ignored. Use the signal editingFinished() instead of focusLost() and returnPressed().
Set the edit box to fit the number of characters in columns, or resize it to fit a previously specified number if columns is zero
Makes a new push button with the given text, adds it to layout if it is non-NULL, and sets it for no focus. layout can be a QHBoxLayout or a QVBoxLayout.
Makes a new check box with the given text, adds it to layout if it is non-NULL, and sets it for no focus. layout can be a QHBoxLayout or a QVBoxLayout.
Makes a new radio button with the given label and with the given parent (which can be NULL), adds it to the button group group with button ID id if group is non-NULL, adds it to layout if it is non-NULL, sets it for no focus, and sets tooltip as the tooltip if it is non-NULL. layout can be a QHBoxLayout or a QVBoxLayout.
Makes a new label with the given text and adds it to layout if it is non-NULL. layout can be a QHBoxLayout or a QVBoxLayout.
Makes a labeled spin box, with the label given by text to the left of the box and right aligned to it, provided that layout is a horizontal layout box in which to place them. (In a toolbar, layout can be NULL.) minValue, maxValue, and step are the minimum, maximum, and step sizes for the spin box. If nDecimal is non-zero, it creates and returns a QDoubleSpinBox with that number of decimal places. It skips the label if text is NULL. The focus policy is set to ClickFocus. Keyboard tracking is turned off. If a pointer is supplied in the optional argument labelPtr (which is NULL by default), it is returned with the label pointer. If the optional argument heightFac is supplied, the minimum height of the spin box will be set to that factor times the font height.
Creates a QVBoxLayout and adds it to layout, replacing the very useful Qt 3 constructor.
Creates a QHBoxLayout and adds it to layout
Creates and returns a new horizontal slider with range from min to max, value value and single step size step, adds it to layout if it is not NULL, and sets it for no focus. The page step and single step are both set to 1.
Creates a QFrame that is a horizontal line with the given parent, and adds it to layout if that is not NULL.
Sets a checkbox or checkable toolbutton button to state with signals blocked
Sets slider to value with signals blocked
Sets a spin box box to value with signals blocked
Sets a double spin box box to value with signals blocked
Sets a spin box box to value and sets its minimum and maximum to min and max, with signals blocked
Turns on button with ID id in button group group, with signals blocked. The ID must be explicitly assigned such as when adding the button to the group.
Sets a text edit edit to the given tex with signals blocked
Shows or hides widget depending on value of state.
Determines a button width appropriate for the given text, multiplying by factor and adding height if rounded is true.
Sets button to a fixed width of appropriate for the given text, multiplying by factor and adding height if rounded is true. The width is returned to use in setting other buttons to the same width.
Returns the desktop size using QApplication::desktop(), or the size of the screen that the widget is on if the optional widget is non-NULL
Gets the maximum window size in width and height, i.e., the desktop size minus assumed borders. If the optional widget is non-NULL, it uses the size of the screen that the widget is on.
Returns the upper left of the assumed usable area of the screen that widget is in in left and top
Limits width and height to the maximum window size; if the optional widget is non-NULL, it uses the size of the screen that the widget is on.
Limits the position of a window with width neww, height newh, and desired position newdx, newdy, adjusting newdx and newdy so that the window should be fully on the screen. This is done differently for X11, Mac, and Windows. The position will be constrained to the screen where the middle of the given position lies, or to the screen that the window is on if optional widget is non-NULL.
Keeps the line edit box edit from making the dialog wider than needed by making its size hint have no effect, setting a minimum width to hold at least numDigits, and giving a stretch factor of stretch in the layout (default 10) so that it does expand in preference to other items in the layout.
Sets the application title into the static variable Dia_title
Puts up an application-model message box with the information string in message and an OK button
Puts up an application-modal message box with an error string in message message and an OK button
Puts up an application-modal message box with the text in question and Yes and No buttons. Returns 0 for no, 1 for yes.
Puts up an application-modal message box with the text in question and Yes, Yes Always, and No buttons. Returns 0 for No, 1 for Yes, 2 for Yes Always.
Puts up an application-modal message box with the text in question and with up to three buttons, whose labels are in lab1, lab2, and lab3. Supply a NULL to omit a button. Returns the number of the button pressed, numbered from 1.
Uses QInputDialog to get an integer or float value from the user. The text should be in prompt; value provides a default or initial value and the new value is returned into this variable unless the user cancels. The If decimal is 0 it sets up a spin box with low and high as its limits; otherwise it gets a float with the given number of decimal places, with low and high specifying scaled lower an upper limits. Returns 0 if the user cancels.
Gets the name of a single existing file with a file chooser that will show caption in its title bar. A set of numFilters filters can be given in filters; the first will be the default filter. Returns an empty string if the user cancels.
Makes a scrolled text window with the text taken a set of character strings passed as variable arguments
Makes a scrolled text window with the text taken from the array of character strings in msg
Deals with several QT-version and/or OS-dependent issues that must be done prior to instantiating the QApplication: substitutes a font on Max; enables high-DPI scaling with Qt 5.6+, either by setting the AA_EnableHighDpiScaling attribute or by setting QT_SCALE_FACTOR environment variable on Linux; and sets style on Linux or Mac if handleStyle is true.
Returns device/pixel ratio for the application if Qt version 5.6+, as well as the maximum ratio for all screens in maxDPR and sets devPixVaries to 1 if the ratio varies, 0 otherwise.
Scales up the size of the application font for Windows by the square root of the device/pixel ratio in devPixRatio, or scales it down by the device/pixel ratio for Linux if QT_SCALE_FACTOR is set, prints the original and scaled font sizes if debug is non-zero, and returns the scaling factor applied
Sets up the library path for Qt so that it loads plugins from the IMOD installation. For Qt 5, this needs to be called before starting the QApplication so that platform plugins can be found.
Works around a hang when starting a QProcess with version 2017 or 2018 of the Intel OpenMP library for Linux by setting environment variable KMP_INIT_AT_FORK=FALSE. This is called by diaSetQtLibraryPath but may need to be called explicitly if that function is called after forking.