Selected PyQt Widgets

Similar documents
Qt Essentials - Widgets Module

LSB Qt4 Toolkit Module Specification for the IA64 Architecture 3.1

Object-Oriented Programming

Report Designer Report Types Table Report Multi-Column Report Label Report Parameterized Report Cross-Tab Report Drill-Down Report Chart with Static

Exercises Lecture 3 Layouts and widgets

Linux Standard Base Desktop Specification for Itanium

Excel 2003 Tutorial II

How to create a prototype

USING JOOMLA LEVEL 3 (BACK END) OVERVIEW AUDIENCE LEVEL 3 USERS

Nauticom NetEditor: A How-to Guide

WEEK NO. 12 MICROSOFT EXCEL 2007

Figure 1 Forms category in the Insert panel. You set up a form by inserting it and configuring options through the Properties panel.

OX Documents Release v Feature Overview

Adobe Dreamweaver Spry Elements

Microsoft How to Series

Week 5 Creating a Calendar. About Tables. Making a Calendar From a Table Template. Week 5 Word 2010

This whitepaper describes the Qt C++ framework. Qt supports the development of crossplatform GUI applications with its write once, compile anywhere

P3e REPORT WRITER CREATING A BLANK REPORT

How to set up a local root folder and site structure

How to Format Tables in the American University Thesis and Dissertation Template

Numbers Basics Website:

Draw Guide. Chapter 9 Adding and Formatting Text

WELCOME TO ALL-TECH SYSTEMS & CO INTRODUCTION TO MICROSOFT WORD TUTORIAL

Introduction to CS Dealing with tables in Word Jacek Wiślicki, Laurent Babout,

How to lay out a web page with CSS

Table Basics. The structure of an table

Qt in Education. The Model View Framework

AVC, Application View Controller User Manual

Word Tips & Tricks. Status Bar. Add item to Status Bar To add an itme to the status bar, click on the item and a checkmark will display.

Virto SharePoint Forms Designer for Office 365. Installation and User Guide

Draw Guide. Chapter 9 Adding and Formatting Text

Dreamweaver MX The Basics

Lava New Media s CMS. Documentation Page 1

4D Write. User Reference Mac OS and Windows Versions. 4D Write D SA/4D, Inc. All Rights reserved.

How to lay out a web page with CSS

Excel 2013 Next Steps

Figure 1 Properties panel, HTML mode

What is interaction? communication user system. communication between the user and the system

Working with PDF s. To open a recent file on the Start screen, double click on the file name.

-Using Excel- *The columns are marked by letters, the rows by numbers. For example, A1 designates row A, column 1.

Lab 12: GUI programming with Qt

Guide to WB Annotations

Access: Using Forms for Data Entry and Editing

User s guide to using the ForeTees TinyMCE online editor. Getting started with TinyMCE and basic things you need to know!

Tutorial 5: Working with Excel Tables, PivotTables, and PivotCharts. Microsoft Excel 2013 Enhanced

Keynote 08 Basics Website:

Fish Eye Menu DMXzone.com Fish Eye Menu Manual

Microsoft Excel is a spreadsheet tool capable of performing calculations, analyzing data and integrating information from different programs.

Microsoft Office Training Skills 2010

DEVELOPING DATABASE APPLICATIONS (INTERMEDIATE MICROSOFT ACCESS, X405.5)

Excel Select a template category in the Office.com Templates section. 5. Click the Download button.

Human-Computer Interaction. Chapter 2. What is HCI?

User Guide. Product Design. Version 2.2.2

BHM Website Teacher User Guide

Impress Guide Chapter 11 Setting Up and Customizing Impress

Getting started with Ms Access Getting Started. Primary Key Composite Key Foreign Key

Chapter 7 Inserting Spreadsheets, Charts, and Other Objects

Computer Essentials Session 1 Lesson Plan

Overview of the Adobe Dreamweaver CS5 workspace

ekaizen Lessons Table of Contents 1. ebook Basics 1 2. Create a new ebook Make Changes to the ebook Populate the ebook 41

Outlook 2010 Cheat Sheet. USC Marshall School of Business Academic Information Services. Table of Contents

Human Computer Interaction Lecture 07. The Interaction

Chapter 14 Setting up and Customizing Calc

User Guide Product Design Version 1.7

Writer Guide. Chapter 15 Using Forms in Writer

Aware IM Version 8.2 Aware IM for Mobile Devices

OS X keyboard shortcuts

Learn more about Pages, Keynote & Numbers

Microsoft Access 2010

Creating Web Pages with SeaMonkey Composer

Tree and Data Grid for Micro Charts User Guide

GWXSlider ActiveX Control

Microsoft Word 2007 on Windows

TIDY LABELS. User Guide

Contact details. Copyright and acknowledgements. Assumptions and conventions. Preface. Limitation of liability

Layout Manager - Toolbar Reference Guide

Microsoft Office 2016 Mail Merge

Information in this document is subject to change without notice. Companies, names, and data used in examples herein are fictitious unless otherwise

Introduction to MS Office Somy Kuriakose Principal Scientist, FRAD, CMFRI

Workshop on Census Data Processing. TELEform Designer User Manual

XLCubed Version 9 QuickStart

A new workbook contains 256 worksheets. The worksheet is a grid of COLUMNS and ROWS. The intersection of a column and a row is called a CELL.

New Perspectives on Microsoft Excel Module 5: Working with Excel Tables, PivotTables, and PivotCharts

GEOCIRRUS 3D Viewer. User Manual: GEOCIRRUS 3D Viewer Document version 1.6 Page 1

Dreamweaver: Accessible Web Sites

Virto SharePoint Forms Designer for Office 365. Installation and User Guide

User Guide. Web Intelligence Rich Client. Business Objects 4.1

Recommended GUI Design Standards

Converting Your PDFs to Excel

A PRACTICAL GUIDE TO USING WIX TO BUILD A WEBSITE

SharePoint List Booster Features

Excel Contents. MS Excel /3/2011 JSD#2-Neptune Page 1

SPARK. User Manual Ver ITLAQ Technologies

PART 7. Getting Started with Excel

Chapter 3 Using Styles and Templates

Rev. C 11/09/2010 Downers Grove Public Library Page 1 of 41

Chapter 10 Using Styles in Calc:

Budget Exercise for Intermediate Excel

Introduction to Microsoft Excel 2010

NHERI SIMCENTER PROGRAMMING BOOTCAMP JULY 30 THROUGH AUGUST 3, 2018, AT UC BERKELEY S RICHMOND FIELD STATION. GUI Development

Transcription:

B Selected PyQt Widgets The screenshots shown here were taken on Linux using KDE to provide an eye-pleasing consistency. In the body of the book, screenshots are shown for Windows, Linux, and Mac OS X, generally varying from chapter to chapter. QCalendarWidget QCheckBox This widget can be used as a display widget, although it was designed primarily as an input widget through which the user can choose a particular date. The widget s display is highly configurable; for example, week numbers can be displayed or not, day names can be represented by a single letter, or in short or full forms, the colors and fonts used can be set, and so can which day is treated as the first day of the week. Minimum and maximum allowable dates can also be set. Calling setcalendarpopup(true) on a QDateEdit or a QDateTimeEdit will cause their spin buttons to be replaced by an arrow button. If the user clicks the arrow button, a QCalendarWidget will pop up. A checkbox can be used to present users with a simple yes/no choice. If QCheckBox.setTristate(True) is called, the checkbox will have three states: The user checked it, the user unchecked it, or the user did not change it from whatever it was before. The tri-state approach may be useful for representing Boolean database fields where IS NULL is allowed. 575

576 Appendix B. Selected PyQt Introduction Widgets QComboBox QDateEdit, QDateTimeEdit, and QTimeEdit QDialogButtonBox QFontComboBox The screenshot shows a QComboBox with its list popped down. A combobox is used to present the user with a list of items where too little vertical space is available for a QListView to be used. Calling QCombo- Box.setEditable(True) allows the user to either choose one of the items in the list, or to type in their own text instead. Each combobox item has text, an optional icon, and optional data. We can populate a combobox using QComboBox.addItem() or QComboBox.addItems(), or we can use a custom or built-in QAbstractItemModel subclass with QComboBox.setModel(). The QDateEdit is used for displaying and entering dates, the QDateTimeEdit is used for dates and times, and the QTimeEdit is used for times. By default, the widgets use locale-specific date and time formats they are shown here using a U.S. locale. The formats can be changed, and minimum and maximum allowable dates and times can be set. This widget can be used to create a row or column of buttons. The buttons can be standard buttons with predefined roles and text, or can be added with the roles and text of our choice. This widget automatically arranges the buttons according to their roles and the underlying windowing system s user interface guidelines. PyQt provides a pop-up font dialog, using the native font dialog where available. If we want to provide font choices ourselves for example, in a toolbar we can use the QFontComboBox, shown here popped down. For Qt 4.0 and Qt 4.1, the nearest equivalent (but without font previewing) is to use an ordinary QComboBox, populating it with the list returned by QFontDatabase.families().

Introduction Appendix B. Selected PyQt Widgets 577 QGroupBox and QRadioButton QGraphicsView QLabel QLCDNumber QLineEdit A group box can be used purely as a visual grouping device, or it can be made checkable, as shown here. If checkable, the widgets contained in the group box can be interacted with only when the group box is checked. If a frame is required without a title, a QFrame can be used instead. When QRadioButtons are put in a group box they automatically behave correctly, that is, the user can choose only one of them. QComboBoxes and QList- Views are often more convenient than QRadioButtons. This widget is used to view the QGraphics- Items in a QGraphicsScene. Any number of QGraphicsViews can view the same scene, each with its own transformations (e.g., scaling and rotation), in effect. The scrollbars appear automatically if they are needed. Each QGraphicsView can provide its own background and foreground, overriding those provided by the scene. The QLabel widget is a display widget that can be used to show an image, a plain text string, a QTextDocument, or HTML. A label with an accelerator (a single underlined character) can be associated with a buddy widget, passing the keyboard focus to the buddy when the accelerator is pressed. This is a display widget for showing numbers in the style of a seven-segment LCD. This widget can accept one line of text from the user. The text can be constrained by using a validator (e.g., a QInt- Validator or a QRegExpValidator), or by setting an input mask, or both. The echo mode can be set to show * s (or nothing) instead of the text entered.

578 Appendix B. Selected PyQt Introduction Widgets QListView and QListWidget QProgressBar QPushButton QSlider QDoubleSpinBox and QSpinBox Through these widgets users can choose an item, or with a suitable selection mode, multiple items. The widgets can be in list mode (as shown), or icon mode, where the icons appear larger and the text is displayed under the icons. A QList- View must be used in conjunction with a custom or built-in QAbstractItemModel subclass using QListView.setModel().A QListWidget has a built-in model, so items can be added to it directly using QListWidget.addItem() and QListWidget.addItems(). Where vertical space is at a premium, a QComboBox can be used instead. This widget can be used to show users the progress of long-running operations. It is often put in a QMainWindow s status bar using QStatusBar. addwidget() or addpermanentwidget(). An alternative is to pop up a QProgressDialog. Buttons are used to invoke actions. If a button click will lead to a dialog being popped up, we normally add an ellipsis ( ) to the end of the button s text. Buttons can also be set to have pop-up menus (in which case, PyQt will add a little triangle indicator), or they can be set as toggle buttons, staying down when clicked an odd number of times and coming back up when clicked an even number of times. Since Qt 4.2, most applications use QDialogButtonBoxes rather than individual QPushButtons. A slider is often used to show proportionality, and is commonly used in conjunction with a QLabel or QLCDNumber that shows an actual amount. Sliders can be aligned vertically or horizontally. A QScrollBar could be used for a similar purpose. These widgets are used to accept and display numbers. The number can be shown with a prefix or suffix and with a particular alignment. (The QDoubleSpinBox shown here has a $ prefix.) They can have minimum and maximum values set, and for the QDoubleSpinBox, the number of digits shown after the decimal point can be set. An alternative is to use a QLineEdit in conjunction with a QInt- Validator or a QDoubleValidator.

Introduction Appendix B. Selected PyQt Widgets 579 QTableView and QTableWidget QTabWidget QTextEdit and QTextBrowser QTreeView and QTreeWidget These widgets are used to present data in tabular form. A QTableView must be used in conjunction with a custom or built-in QAbstractItemModel subclass, such as QSqlTableModel, using QTable- View.setModel(). A QTableWidget has a built-in model, so items can be added to it directly for example, using QTable- Widget.setItem(). Both widgets can show icons as well as text in every cell, including in the header cells. This widget is used when space is at a premium, or simply as a means of logically grouping widgets. The tabs have two shape settings and can appear at the top, left, right, or bottom, with the text rotated when shown left or right. These widgets can display HTML, including lists, tables, and images. The QTextEdit can also be used as an editing widget, either for plain text or for PyQt rich text (essentially HTML, although a custom subclass would be needed to provide table and image editing). The QTextBrowser supports clickable links, so it can be used as a simple Web browser. Both widgets have support for CSS (Cascading Style Sheets). These widgets are used to present hierarchical data. A QTreeView must be used with a custom or built-in QAbstract- ItemModel subclass using QTreeView.set- Model(). Like all widgets that use a model, only the data that is visible to the user is retrieved, so even large datasets are very fast. A QTreeWidget has a builtin model, so items can be added to it directly using QTreeWidget.insertTop- LevelItem() and inserttoplevelitems(), or by creating QTreeWidgetItems as children of other items.