- Basic Qt Programming Tutorial
- Before you start: Download and install Qt and Qt Creator
- Baby steps: Creating a new project
- Learning to crawl: Editing the project files
- Up and running: Building and running the application
- how to rip a multi-track mix cd to a single mp3 file
- Thread: Make (not burn using) cue sheets
- Make (not burn using) cue sheets
- Re: Make (not burn using) cue sheets
- Re: Make (not burn using) cue sheets
- Re: Make (not burn using) cue sheets
- Re: Make (not burn using) cue sheets
Basic Qt Programming Tutorial
This tutorial will explain in detail how to take your first steps in programming with Qt using the Qt Creator integrated development environment (IDE).
If you want to learn how to make powerful GUIs with all the latest fancy technologies, this is not the tutorial for you. This is firmly intended as a gentle introduction to help beginners get up and running without scaring them.
We will begin by creating a new Qt-based project and modifying the generated code to show a very simple graphical user interface (GUI). Once our basic application project is in place and running, we will go back and modify it to do some slightly useful things.
We will start off simple and build up in complexity as you get more familiar with the widgets and other facilities at your disposal.
Before you start: Download and install Qt and Qt Creator
Grab yourself a copy of the Qt SDK or if you are on Linux the system-provided copy of Qt and a compiler.
If you are starting off you might want to consider the open source LGPL version.
The open source downloads can be found on the qt.io website here.
For commercial use consider getting a Qt Commercial license.
Baby steps: Creating a new project
Let’s try making a trivial application that has a single window that shows a QLabel and a QLineEdit. To do this follow these simple steps:
Go to File — New File or Project menu entry
Choose Qt Gui Application and choose a name for it:
Enter a project name, «qt-tutorial-01», say.
Select one or more versions of Qt to target. A desktop build is fine for this tutorial.
Select the base class to be QWidget (leave the class name as Widget which is the default).
Check project creation options on summary and click «Finish».
The above will create you a simple project consisting of four files:
Learning to crawl: Editing the project files
We will edit the widget.ui file first so:
Click on that and designer will switch to design mode and open up the file. You should see a blank widget. Now do this:
Using the toolbox on the left, drag a Label onto the widget form
Do similarly for a Line Edit and place it to the right of the Label. The exact position is not important.
Click on the widget background so that both of your new widgets (the label and line edit) get deselected.
In the toolbar at the top click on the «Lay out Horizontally» button or press Ctrl-H to add all widgets to a horizontal layout. The layout will take care of resizing your widgets for you if the parent widget’s size changes.
Double click on the Label and it will switch to edit mode. Change the text to «My name is:»
Press Ctrl-S to save the form.
Click on the Edit mode button in the left hand panel of creator to switch back to the text editor. You will probably see the raw xml content of the UI file at this point. Just close it we are done with it for now.
Now open up the widget.h file and edit it so that it looks like this:
#ifndef WIDGET_H #define WIDGET_H #include namespace Ui class Widget; > class Widget : public QWidget Q_OBJECT public: explicit Widget(QWidget *parent = 0); ~Widget(); void setName(const QString &name); QString name() const; private: Ui::Widget *ui; >; #endif // WIDGET_H
Now edit the corresponding .cpp file to look like this:
#include "widget.h" #include "ui_widget.h" Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) ui->setupUi(this); > Widget::~Widget() delete ui; > void Widget::setName(const QString &name) ui->lineEdit->setText(name); > QString Widget::name() const return ui->lineEdit->text(); >
Finally edit main.cpp to this:
#include #include "widget.h" int main(int argc, char *argv[]) QApplication a(argc, argv); Widget w; w.setName("Slim Shady"); w.show(); return a.exec(); >
Up and running: Building and running the application
Now build (Hammer icon in lower left or default shortcut of Ctrl-Shift-B) and run the application (green «play» icon in lower left corner). You will see some compiler messages go past in the «Compile Output» panel at the bottom whilst building.
This is what the application looks like when it is executed:
As you can see the main() function is very simple. All we do is create a QApplication and then a Widget (this is our custom widget that we layed out in designer and added custom behaviour to in code with the name() and setName() functions).
We then just call our custom setName function on the widget. This in turn gets a pointer to the QLineEdit widget that we placed on the form and calls the setText() function of QLineEdit.
Finally we show the widget and enter the event loop by calling a.exec().
Once you understand how this simple app works then you can start adding some more bells and whistles like signal/slot connections.
how to rip a multi-track mix cd to a single mp3 file
Sometimes you get these CDs that contain a mix or has to be played seamlessly as all tracks flow into each other. When you want to rip that CD to convenient mp3 or ogg files however, you end up with a bunch of individual files which have to be played in the right sequence, or the mix gets screwed up, and it has to be played seamlessly, without the slightest of delays inbetween the tracks, or the mix gets screwed up again.
To avoid this kind of frustrating nastiness on all sorts of different soft- or hardware mp3 players, I thought it would be a good idea to rip the mix as a single big mp3 file. Unfortunately my favorite ripping software (CDex) doesn’t allow this, and only rips the individual tracks into individual files. With the use of some more free tools, I managed to get the job done however. Yay for me!
So here’s the rundown on how to rip a mix CD to as single mp3 file:
- Rip all individual tracks to wav files using the open source CDex audio CD ripper tool. Make sure you include the track number as the first part of the filename. This is handy afterwards.
- Download the free program called WaveCat. It looks really old, and it probably is, but it does the trick so what the heck. Using WaveCat you select all your previously ripped wav files and concatenate them all together into one big mofo of a file. The track number the filename will have the tracks sorted nicely for you now, so you can just hit “Select all” and the “Catenate” button after entering a descriptive filename.
- Using Audacity, an open source audio editing and recording tool, you can now open the huge wave file (this will take a while), and then simply export it in mp3 or ogg format (this will also take a while).
That’s it.
If you know a quicker way, feel free to let me know in the comments. I think it’s too much of a hassle like this really, but then again, it’s not like I have to do this a lot.
Thread: Make (not burn using) cue sheets
Just Give Me the Beans!
Make (not burn using) cue sheets
I’m a DJ, and when I record a set I need to be able to split and burn it to CD on-demand as audio or data in any format or bitrate I choose from a master WAV (or FLAC) file. The problem is I can’t find a tool to make cue sheets. they seem to only support using pre-made cue sheets for various purposes.
Do you guys know of any tools for making cue files?
Ubuntu Member
Join Date Apr 2006 Location Vancouver, Canada Beans 1,856 —> Beans 1,856 Distro Ubuntu 14.10 Utopic Unicorn
Re: Make (not burn using) cue sheets
What makes a great open source contributor is not primarily the brilliance of their ideas or importance of their bug, but rather their willingness to see it through to success.
Just Give Me the Beans!
Re: Make (not burn using) cue sheets
Thank you, this was the missing piece of the puzzle I was looking for. I wonder why some programs aren’t set up through synaptic.
Ubuntu Member
Join Date Apr 2006 Location Vancouver, Canada Beans 1,856 —> Beans 1,856 Distro Ubuntu 14.10 Utopic Unicorn
Re: Make (not burn using) cue sheets
The Ubuntu repos (what synaptic draws from) simply can’t house all the possible apps available (nor do they see a need to), the maintenance is just too big of a task. Google is your best friend. I didn’t even know how to properly format a cue sheet before I stumbled onto your thread, I was splitting all my DJ sets manually in a wave editor. Thanks for helping me learn a thing or two.
What makes a great open source contributor is not primarily the brilliance of their ideas or importance of their bug, but rather their willingness to see it through to success.
First Cup of Ubuntu
Re: Make (not burn using) cue sheets
I’m a Linux beginner. I’ve been looking for a CUE sheet editor that can guide me through the CUE sheet and seek for errors, because Gnome Baker tells me
Cdrdao version 1.2.2 - (C) Andreas Mueller SCSI interface library - (C) Joerg Schilling Paranoia DAE library - (C) Monty Check http://cdrdao.sourceforge.net/drives.html#dt for current driver tables. Pregap out of range
. so I want to find out where is the problem.
I know the CUE sheet structure and how to write it but I have no clue why is the Pregap out of range.
I searched and found this thread and I wanted to try out QeD app.
Unfortunately because I’m a beginner I have a difficulty to install it.
The qed_2.0_setup.bin can’t be opened by gdebi-gtk, the package installer and the same is with the qed_2.0.zip
Help guide didn’t help me at all.