Getting Started with Qt 5 by Benjamin Baka
Author:Benjamin Baka [Benjamin Baka]
Language: eng
Format: epub
Tags: COM051070 - COMPUTERS / Programming Languages / C++, COM087020 - COMPUTERS / Desktop Applications / Design and Graphics, COM051460 - COMPUTERS / Programming / Mobile Devices
Publisher: Packt
Published: 2019-02-28T10:51:47+00:00
Add the following lines of code to the mainwindow.cpp file that defines the createIcons() method:
void MainWindow::createIcons() {
newIcon = QPixmap("new.png");
openIcon = QPixmap("open.png");
closeIcon = QPixmap("close.png");
clearIcon = QPixmap("clear.png");
}
The createIcons() method will pass instances of QPixmap to the members that were declared in mainwindow.h.
The definition of setupCoreWidgets() is as follows, in mainwindow.cpp:
void MainWindow::setupCoreWidgets() {
mainWidget = new QWidget();
centralWidgetLayout = new QVBoxLayout();
formLayout = new QGridLayout();
buttonsLayout = new QHBoxLayout();
nameLabel = new QLabel("Name:");
dateOfBirthLabel= new QLabel("Date Of Birth:");
phoneNumberLabel = new QLabel("Phone Number");
savePushButton = new QPushButton("Save");
newPushButton = new QPushButton("Clear All");
nameLineEdit = new QLineEdit();
dateOfBirthEdit = new QDateEdit(QDate::currentDate());
phoneNumberLineEdit = new QLineEdit();
// TableView
appTable = new QTableView();
model = new QStandardItemModel(1, 3, this);
appTable->setContextMenuPolicy(Qt::CustomContextMenu);
appTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); /** Note **/
model->setHorizontalHeaderItem(0, new QStandardItem(QString("Name")));
model->setHorizontalHeaderItem(1, new QStandardItem(QString("Date of Birth")));
model->setHorizontalHeaderItem(2, new QStandardItem(QString("Phone Number"))); appTable->setModel(model)
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Deep Learning with Python by François Chollet(12526)
Hello! Python by Anthony Briggs(9871)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9761)
The Mikado Method by Ola Ellnestam Daniel Brolund(9752)
Dependency Injection in .NET by Mark Seemann(9297)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8262)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7745)
Grails in Action by Glen Smith Peter Ledbrook(7671)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7521)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(6759)
Microservices with Go by Alexander Shuiskov(6526)
Practical Design Patterns for Java Developers by Miroslav Wengner(6422)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6401)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6383)
Angular Projects - Third Edition by Aristeidis Bampakos(5785)
The Art of Crafting User Stories by The Art of Crafting User Stories(5313)
NetSuite for Consultants - Second Edition by Peter Ries(5254)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5075)
Kotlin in Action by Dmitry Jemerov(5023)
