PDA

View Full Version : programin in the qt creator



hamedazimi
28th February 2011, 05:21
im started with qt creator,i what write source code for a label is on form .ui placing

tbscope
28th February 2011, 11:18
code for on form .ui is placing in writing of qt creator code thingy or designer whatsitcalled.

In other words:
What?

hamedazimi
1st March 2011, 15:26
I just wanted to see I started qt creator, how can write source code for the label set on form mainwindow.h

szisziszilvi
2nd March 2011, 10:53
maybe he uses a translator program.

tbscope
2nd March 2011, 14:21
maybe he uses a translator program.

That's possible, but being a simple human being, I can't know that.
Furthermore, I can't even know what he/she was asking in the first place, translator program or not.

As for writing code for a label being placed with designer:
Normally, if you use Qt Creator with a standard template, a couple of files are generated. Suppose your main window is in the files mainwindow.h and mainwindow.cpp
In these files a class called something like MainWindow is defined and it will use the ui object which represents the user interface made by designer.
You use this ui object to access and control the widgets set in designer.

Example:

ui->myLabel->setText("Hello world!");

hamedazimi
3rd March 2011, 12:23
Were the basis of the code that I wrote. not run.
I want to see how one label or a button in qt creator on form .ui write code.

hamedazimi
4th March 2011, 05:53
file://C:\Users\hamed\Desktop\shidfar ht\1.jpg

hamedazimi
5th March 2011, 09:53
I wrote this code but the button signal and slot does not run
If you can help thank you that you are my answers.


#include "mainwindow.h"
#include <QTextEdit>
#include <QPushButton>
#include <QVBoxLayout>
#include <QString>
#include <QFileDialog>
#include <QDir>
#include <QComboBox>


MainWindow::MainWindow(QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent, flags)

{

ui.setupUi(this);
ui.pushButton->connect(ui.pushButton,SIGNAL(clicked()),ui.comboBo x_3,SLOT(browse()));
}
void MainWindow:: browse()
{


ui.comboBox_3->addItem((QDir::currentPath()));
QString dire=QFileDialog::getExistingDirectory(this,tr("find file"),QDir::currentPath());
if(!dire.isEmpty());
ui.comboBox_3->addItem(dire);
ui.comboBox_3->setCurrentIndex(ui.comboBox_3->currentIndex()+1);
}



MainWindow::~MainWindow()
{


}

squidge
5th March 2011, 12:53
Slot does not run because you use connect incorrectly.



ui.pushButton->connect(ui.pushButton,SIGNAL(clicked()),ui.comboB ox_3,SLOT(browse()));


is not good.

Please see the examples.

I also do not understand slot browse() of comboBox_3. According to your code, this should be MainWindow, as thats where browse lives?

hamedazimi
8th March 2011, 20:04
Whether qt programming is on ic and how the programin in Industry

Added after 5 minutes:

Whether qt programming is on ic and how the programin in Industry

squidge
8th March 2011, 22:12
I do not understand.

stampede
8th March 2011, 23:02
I do not understand.
And I doubt that anyone does - dear hamedazimi, as long as you are not going to improve your english language skills, you'll get no constructive feedback - simply because people can't understand what you mean. There are plenty of people around here, willing to help others, but without understanding each other it's just not going to work...

hamedazimi
10th March 2011, 19:51
does QT support IC programming?ta.

squidge
10th March 2011, 20:49
What is IC programming?

Do you mean does Qt (note: Not QT) support embedded hardware? Yes it does.

hamedazimi
12th March 2011, 19:44
wanna know how i can do hardware programing in qt?

squidge
12th March 2011, 19:48
In the same way as you would do hardware programming without Qt.