Creating a theApp - ZoomTen/theApp GitHub Wiki
Mamma mia.
- Clone the repo and reset everything as written in the README.
- Rename
theAppfolder into something awesome, liketheBlamor whatever. This will be your project name, and any instance of "theBlam" from now on should be replaced with your project name. - Rename
theApp.prototheBlam.pro. - Rename the
app-barebonesfolder toapp. Likewise, change up theapp-barebonesline in theApp.pro to sayappinstead. - Go in the
appdirectory. - Rename
app-barebones.protoapp.pro, then in that file, changetheApp(line 4) totheBlam. Next change every other reference totheAppin the file totheBlamortheblamdepending on the capitalization. - Change
com.zumidin the file tocom.anonymous(orcom.<yournamehere>) - Rename the
com.zumid.theApp.desktopfile tocom.anonymous.theBlam.desktopjust like what you replaced in the previous step. - Open that file and replace all instances of
theAppwiththeBlam. - In the
iconsfolder renametheapp.svgtotheblam.svg. - In mainWindow.ui change every instance of
theAppwiththeBlam(ortheblamdepending on capitalization) - In resources.qrc change
icons/theapp.svgtoicons/theblam.svg - In main.cpp change every instance of
theAppwiththeBlamandcom.zumid.theApptocom.anonymous.theBlam. - In line 77 and 78 of main.cpp change the copyright holder string to your name and the year to the current year.
- You might want to change line 88 of main.cpp to say something else. Basically where the config files will be stored:
~/.config/<SOMETHING>/theBlam
- Check if it builds using the commands described in the README
- If it builds, congrats, you can start stuffing stuff in it.
- Make a folder titled
mypageor whatever. - In Qt Creator, it's piss easy to make the files, just right click any file and click Add New. Then select Qt Designer Form Class. Make a widget called MyPage, then set the folder to the folder you just made. Done!
- Otherwise...
mypage/mypage.h
#ifndef MYPAGE_H
#define MYPAGE_H
#include <QWidget>
namespace Ui {
class MyPage;
}
class MyPage : public QWidget
{
Q_OBJECT
public:
MyPage(QWidget *parent = nullptr);
~MyPage();
private:
Ui::MyPage *ui;
};
#endifmypage/mypage.cpp
#include "mypage.h"
#include "ui_mypage.h"
MyPage::MyPage(QWidget *parent) :
QWidget(parent),
ui(new Ui::MyPage)
{
ui->setupUi(this);
}
MyPage::~MyPage()
{
delete ui;
}mypage/mypage.ui you're gonna want to open this in Qt Designer
<ui version="4.0">
<author/>
<comment/>
<exportmacro/>
<class>MyPage</class>
<widget class="QWidget" name="MyPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
</widget>
<pixmapfunction/>
<connections/>
</ui>- And you're gonna want to add these file names to app.pro, to HEADERS, SOURCES, and FORMS, respectively:
SOURCES += \
main.cpp \
mainwindow.cpp \
mypage/mypage.cpp
HEADERS += \
mainwindow.h \
mypage/mypage.h
FORMS += \
mainWindow.ui \
mypage/mypage.ui-
Next, do anything you want with it.

-
To get the custom
the-libsclasses a-runnin', right click any widget and click Promoted Widgets. In New Promoted Class, set the base class name to QLabel and type intTitleLabelin Promoted Class Name. Check global include and hit Add. Now you can make the Hello World thingy a tTitleLabel by right clicking, Promote to -> tTitleLabel. It won't show in Designer, but it will look bigger once you build and run the app. -
Save and now edit mainWindow.ui in Designer.
-
Drop a Stacked Widget right in the middle. Right-click on stackedWidget on the Object Inspector, Page 1 of 2 -> Delete.
-
Right click on page2 and choose Promote to. With the base class set to QWidget, set the promoted class name to
MyPage. The header file ismypage/mypage.hand make sure global include isn't checked. Click Add and then click Promote. -
Right click on stackedWidget and click Promote to. The base class should be QStackedWidget. Type in
tStackedWidgetin the promoted class name and this time check global include. Add and promote. -
Save and then build.
You should see this when you run the app, but not after resizing the gargantuan screen that Qt Designer gives you by default:
