c++ - 需要有关 Qt 代码块配置的帮助!

标签 c++ codeblocks qt4.6

代码块 8.02。 , 赢 xp SP2 , Qt 4.6

安装 Qt SDK 后,我安装了 QtWorkbench(允许您创建 Qt 应用程序的代码块插件。)http://code.google.com/p/qtworkbench/ .

我按照该页面的指示工作。我打开文件夹“dialogs”并在其中打开一个新的空代码块项目。同样在这个文件夹“dialogs”中,我打开了一个新目录“complexwizard”。在 complexwizard 中是简单的 main.cpp :

#include <QWidget>
#include <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();
}

然后我在一个空白项目中添加了“main.cpp”,并根据该页面的说明进行了所有配置。

当我开始编译程序时,编译器总是说:

* 看来这个项目还没有建起来。你想现在买吗? *

我按"is"并收到此消息:

进程终止,状态为 2(0 分 0 秒) 0 个错误,0 个警告

在项目所在的“dialogs”文件夹中,创建了新文件:

复杂向导.pro

Makefile.complexwizard

Makefile.complexwizard.Debug

Makefile.complexwizard.Release

由于我对编程、编译器和其他事物的世界还比较陌生,所以这并不能告诉我太多信息。

因此,我请求有人根据这些症状提出一些建议,帮助我解除它的停顿。 如果您有兴趣,我会添加更多需要的数据

最佳答案

我是 QtWorkbench 的作者,我已经停止支持它一段时间了。我很确定它现在已经过时了。我真的认为新的 Qt 用户应该使用 QtCreator 这个“官方”Qt IDE 以获得开箱即用的最佳支持。 QtWorkbench 仍在 Google Code 中,以防有人想开始开发它。

关于c++ - 需要有关 Qt 代码块配置的帮助!,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3136054/

相关文章:

无法在 CodeBlocks 中使用 SDL_LoadBMP 加载 bmp 文件

c++ - Qt:动画 QWidget 的 'roll down'

c++ - 寄存器、c++14 和 gcc 的编译错误

c++ - 重载函数调用在 C++ 中如何工作?

c++ - 获取文档类名称

c++ - 如何在 C++ 中重用基于不同类型的表?

python - 具有任意局部变量的 exec() 字节码?

c++ - 代码块 libcurl 链接问题 Windows 7

c++ - 创建简单的 qml 应用程序

c++ - 如何防止在 MayBeGesture 状态下超时删除手势?