CopperSpice API  1.7.2
Widgets and Layouts

Widgets are the primary elements for creating user interfaces in CopperSpice. Widgets can display data and status information, receive user input, and provide a container for other widgets that should be grouped together. A widget that is not embedded in a parent widget is called a window.

The QWidget class provides the basic capability to render to the screen, and to handle user input events. All UI elements that CopperSpice provides are either subclasses of QWidget, or are used in connection with a QWidget subclass. Creating custom widgets is done by subclassing QWidget or a suitable subclass and reimplementing the virtual event handlers.

Layouts

Layouts are an elegant and flexible way to automatically arrange child widgets within their container. Each widget reports its size requirements to the layout through the sizeHint and sizePolicy properties, and the layout distributes the available space accordingly.

The Qt Designer is a powerful tool for interactively creating and arranging widgets in layouts.

Widget Styles

Styles draw on behalf of widgets and encapsulate the look and feel of a GUI. The CopperSpice built-in widgets use the QStyle class to perform nearly all of their drawing, ensuring that they look exactly like the equivalent native widgets.

CopperSpice Style Sheets are a powerful mechanism that allows you to customize the appearance of widgets, in addition to what is already possible by subclassing QStyle.

Refer to the Widget Gallery for more examples.

Basic Widgets

These basic widgets controls, e.g. buttons, comboboxes and scroll bars, are designed for direct use.

QCheckBox Checkbox with a text label
QComboBox Combined button and popup list
QCommandLinkButton Vista style command link button
QDateEdit Widget for editing dates based on the QDateTimeEdit widget
QDateTimeEdit Widget for editing dates and times
QTimeEdit Widget for editing times based on the QDateTimeEdit widget
QDial Rounded range control (like a speedometer or potentiometer)
QFocusFrame Focus frame which can be outside of a widget's normal paintable area
QFontComboBox Combobox that lets the user select a font family
QLabel Text or image display
QLCDNumber Displays a number with LCD like digits
QLineEdit One-line text editor
QMenu Menu widget for use in menu bars, context menus, and other popup menus
QProgressBar Horizontal or vertical progress bar
QPushButton Command button
QRadioButton Radio button with a text label
QScrollArea Scrolling view onto another widget
QScrollBar Vertical or horizontal scroll bar
QSizeGrip Resize handle for resizing top-level windows
QSlider Vertical or horizontal slider
QSpinBox Spin box widget
QDoubleSpinBox Spin box widget that takes doubles
QTabBar Tab bar, for example for use in tabbed dialogs
QTabWidget Stack of tabbed widgets
QTimeEdit Widget for editing times based on the QDateTimeEdit widget
QToolBox Column of tabbed widget items
QToolButton Quick-access button to commands or options, usually used inside a QToolBar
QWidget Base class of all user interface objects

Advanced Widgets

Advanced GUI widgets like tab widgets and progress bars provide more complex user interface controls.

QCalendarWidget Monthly based calendar widget allowing the user to select a date
QColumnView Model/view implementation of a column view
QDataWidgetMapper Mapping between a section of a data model to widgets
QDesktopWidget Access to screen information on multi-head systems
QListView List or icon view onto a model
QMacCocoaViewContainer Widget for Mac OS X, can be used to wrap NSView Widgets and insert them into CopperSpice hierarchies
QMacNativeWidget Widget for Mac OS X, provides a way to put widgets into a Cocoa hierarchy
QTableView Default model/view implementation of a table view
QTreeView Default model/view implementation of a tree view
QUndoView Displays the contents of a QUndoStack
QWebView Widget that is used to view and edit web documents

Organizer Widgets

Classes like splitters, tab bars, button groups, etc are used for organizing and grouping GUI primitives into more complex applications and dialogs.

QButtonGroup Container to organize groups of button widgets
QGroupBox Group box frame with a title
QSplitter Implements a splitter widget
QSplitterHandle Handle functionality of the splitter
QStackedWidget Stack of widgets where only one widget is visible at a time
QTabWidget Stack of tabbed widgets

Abstract Widget Classes

The abstract widget classes are base classes. They are not usable as standalone classes but provide functionality when they are subclassed.

QAbstractButton The abstract base class of button widgets, providing functionality common to buttons
QAbstractScrollArea Scrolling area with on-demand scroll bars
QAbstractSlider Integer value within a range
QAbstractSpinBox Spinbox and a line edit to display values
QDialog The base class of dialog windows
QFrame The base class of widgets that can have a frame

Model/View Classes

The model/view architecture provides classes that manage the way data is presented to the user. Data-driven applications which use lists and tables are structured to separate the data and view using models, views, and delegates.

QAbstractItemModel Abstract interface for item model classes
QAbstractListModel Abstract model that can be subclassed to create one-dimensional list models
QAbstractTableModel Abstract model that can be subclassed to create table models
QModelIndex Used to locate data in a data model
QPersistentModelIndex Used to locate data in a data model
QAbstractProxyModel Base class for proxy item models that can do sorting, filtering or other data processing tasks
QIdentityProxyModel Proxies its source model unmodified
QItemSelection Manages information about selected items in a model
QItemSelectionModel Keeps track of a view's selected items
QItemSelectionRange Manages information about a range of selected items in a model
QSortFilterProxyModel Support for sorting and filtering data passed between another model and a view
QStringListModel Model that supplies strings to views
QStandardItem Item for use with the QStandardItemModel class
QStandardItemModel Generic model for storing custom data
QFileSystemModel Data model for the local filesystem
QAbstractItemDelegate Used to display and edit data items from a model
QAbstractItemView The basic functionality for item view classes
QColumnView Model/view implementation of a column view
QDataWidgetMapper Mapping between a section of a data model to widgets
QHeaderView Header row or header column for item views
QItemDelegate Display and editing facilities for data items from a model
QItemEditorCreator Makes it possible to create item editor creator bases without subclassing QItemEditorCreatorBase
QItemEditorCreatorBase Abstract base class that must be subclassed when implementing new item editor creators
QItemEditorFactory Widgets for editing item data in views and delegates
QStandardItemEditorCreator The possibility to register widgets without having to subclass QItemEditorCreatorBase
QListView List or icon view onto a model
QListWidget Item-based list widget
QListWidgetItem Item for use with the QListWidget item view class
QStyledItemDelegate Display and editing facilities for data items from a model
QTableView Default model/view implementation of a table view
QTableWidget Item-based table view with a default model
QTableWidgetItem Item for use with the QTableWidget class
QTableWidgetSelectionRange Way to interact with selection in a model without using model indexes and a selection model
QTreeView Default model/view implementation of a tree view
QTreeWidget Tree view that uses a predefined tree model
QTreeWidgetItem Item for use with the QTreeWidget convenience class
QTreeWidgetItemIterator Way to iterate over the items in a QTreeWidget instance

Layout Classes

QGraphicsAnchor Represents an anchor between two items in a QGraphicsAnchorLayout
QGraphicsAnchorLayout Layout where one can anchor widgets together in Graphics View
QBoxLayout Lines up child widgets horizontally or vertically
QHBoxLayout Lines up widgets horizontally
QVBoxLayout Lines up widgets vertically
QFormLayout Manages forms of input widgets and their associated labels
QGridLayout Lays out widgets in a grid
QLayout The base class of geometry managers
QLayoutItem Abstract item that a QLayout manipulates
QSpacerItem Blank space in a layout
QWidgetItem Layout item that represents a widget
QSizePolicy Layout attribute describing horizontal and vertical resizing policy
QStackedLayout Stack of widgets where only one widget is visible at a time
QButtonGroup Container to organize groups of button widgets
QGroupBox Group box frame with a title
QStackedWidget Stack of widgets where only one widget is visible at a time

Window and Related Classes

QAction Abstract user interface action that can be inserted into widgets
QActionGroup Groups actions together
QWidgetAction Extends QAction by an interface for inserting custom widgets into action based containers, such as toolbars
QDockWidget Widget that can be docked inside a QMainWindow or floated as a top-level window on the desktop
QMainWindow Main application window
QMdiArea Area in which MDI windows are displayed
QMdiSubWindow Subwindow class for QMdiArea
QMenu Menu widget for use in menu bars, context menus, and other popup menus
QMenuBar Horizontal menu bar
QSizeGrip Resize handle for resizing top-level windows
QStatusBar Horizontal bar suitable for presenting status information
QToolBar Movable panel that contains a set of controls