Blockchain By Example
上QQ阅读APP看书,第一时间看更新

Graphical interface addition

To start modifying the UI part, download and install the Qt dedicated IDE,Qt Creator, which includes neat tools for UI design as follows: sudo apt-get install qtcreator.

Let's proceed with the import of the project as follows:

  1. Run Qt Creator using: qtcreator.
  2. When the IDE shows up, in Qt Creator start a New Project. A new dialog form will show up as shown in the following screenshot. Then choose Import Project as the template, followed by Import Existing Project:

  1. Enter readercoin-qt as the project name, and then select the location of src/qt in your Readercoin project (workspace/readercoin/src/qt):

  1. A new interface will show up suggesting you choose files to import. Leave the proposed file selection as it is. We then import all the files located under the src/ folder:

  1. A summary page dialog will show up where you can optionally indicate your git repository, before finally confirming the project import:

When the project is successfully imported, Qt Creator creates the project tree in the sidebar. After importing a generic project into Qt Creator, you can open it next time by selecting the .creator file created in the src/folder.

In the Project section in the left-hand column, select Manage Kits..., and then, in the Build & Run section,select the build configuration, and set your compiler and debugger if it is not auto-detected:

All set? You can start building the project with Qt Creator by pressing the green triangle button. It will ask you to specify the executable name and path, along with the arguments to use when running your executable. Thus, we specify src/qt/readercoin-qt or readercoind as an executable, and -printtoconsole as an argument:

During the project build, you should see the log printed in the Qt Creator application output. If you edit any value using Qt Creator, you'll have to recompile the code to get your modification included in your Readercoin client:

As you'll notice, Qt Creator only gives you access to the client code. In order to edit graphical forms, start qt-designer by double-clicking on the file with a .ui extension located under qt/forms/:

Using both Qt Creator and Qt Designer, play around by removing or adding graphical elements. If you want to add new Qt features, you should have a basic knowledge of Qt/C++. After each modification, compile the code by pressing the green triangle located in the bottom left of qt-creator.