开发者

Need help with configuration of codeblocks for Qt !

codeblocks 8.02. , win xp SP2 , Qt 4.6

After installing Qt SDK, I installed QtWorkbench (codeblocks plugin that allows you to create Qt applications.) http://code.google.com/p/qtworkbench/.

I worked under instructions from that page. I opened the folder "dialogs" and in it I opened a new empty codeblocks project. Also in this folder "dialogs" I opened a new directory "complexwizard". In complexwizard is simple main.cpp :

#include <QWidget>
#inc开发者_运维技巧lude <QApplication>
#include <QPushButton>
#include <QLabel>
#include <QDesktopWidget>


class Communicate : public QWidget
{
  Q_OBJECT

  public:
    Communicate(QWidget *parent = 0);

  private slots:
    void OnPlus();
    void OnMinus();

  private:
    QLabel *label;

};


void center(QWidget *widget, int w, int h)
{
  int x, y;
  int screenWidth;
  int screenHeight;

  QDesktopWidget *desktop = QApplication::desktop();

  screenWidth = desktop->width();
  screenHeight = desktop->height();

  x = (screenWidth - w) / 2;
  y = (screenHeight - h) / 2;

  widget->move( x, y );
}


Communicate::Communicate(QWidget *parent)
 : QWidget(parent)
{
  int WIDTH = 350;
  int HEIGHT = 190;

  resize(WIDTH, HEIGHT);

  QPushButton *plus = new QPushButton("+", this);
  plus->setGeometry(50, 40, 75, 30);

  QPushButton *minus = new QPushButton("-", this);
  minus->setGeometry(50, 100, 75, 30);

  label = new QLabel("0", this);
  label->setGeometry(190, 80, 20, 30);

  connect(plus, SIGNAL(clicked()), this, SLOT(OnPlus()));
  connect(minus, SIGNAL(clicked()), this, SLOT(OnMinus()));


  center(this, WIDTH, HEIGHT);

}

void Communicate::OnPlus()
{
  int val = label->text().toInt();
  val++;
  label->setText(QString::number(val));
}

void Communicate::OnMinus()
{
  int val = label->text().toInt();
  val--;
  label->setText(QString::number(val));
}



int main(int argc, char *argv[])
{

  QApplication app(argc, argv);

  Communicate window;

  window.setWindowTitle("Communicate");
  window.show();



  return app.exec();
}

Then I added, "main.cpp" in a blank project and all configured according to the instructions from that page.

When I started to compile the program, compiler always says:

* It seems that this project has not been built yet. Do you want to buid it now? *

I press yes an got this message :

Process terminated with status 2 (0 minutes, 0 seconds) 0 errors, 0 warnings

In the folder "dialogs" where is a project, new files are created:

complexwizard.pro

Makefile.complexwizard

Makefile.complexwizard.Debug

Makefile.complexwizard.Release

Since I am relatively new to the world of programming, compiler and other things, this does not tell me much.

Therefore, I ask someone who has some suggestion on the basis of these symptoms to help me remove it from standstill. If you're interested, I'll add more data that will need


I 'm the author of QtWorkbench and I have stopped supporting it some time ago. I 'm pretty sure it's outdated by now. I really think that new Qt users should go with QtCreator the "official" Qt IDE to get the best support out of the box. QtWorkbench is still in Google Code in case any one wants to pick up developing it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜