2 Replies - 978 Views - Last Post: 22 August 2011 - 08:40 AM Rate Topic: -----

#1 Snowsoman  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 25-October 10

Visual Studio C++ Qt problem

Posted 22 August 2011 - 07:06 AM

I am trying to build a GUI using Qt in Visual Studio 2008. I have the Qt add-in for Visual Studio if that matters. When I compile the code I get no errors ,but nothing is showing.I believe my code is correct,but not really sure Any help that can be provide will be much appreciated.

seniorproject.h


#ifndef SENIORPROJECT_H
#define SENIORPROJECT_H
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QtGui>
#include <QMainWindow>
#include "ui_seniorproject.h"

class Seniorproject : public QMainWindow
{
	Q_OBJECT

public:
	Seniorproject(QWidget *parent = 0, Qt::WFlags flags = 0);
        	~Seniorproject();

//most likley using for varous signals
signals:


//most likley using for buttons 
private slots:

private:
	QLabel *label1;//Mode
	QLabel *label2;//IP Address
	QLineEdit *lineEdit;
	QPushButton *disconnectButton;
	QPushButton *connectButton;
	QPushButton *closeButton;
	Ui::SeniorprojectClass ui;
};

#endif // SENIORPROJECT_H




seniorproject.cpp


#ifndef SENIORPROJECT_H
#define SENIORPROJECT_H
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QtGui>
#include <QMainWindow>
#include "ui_seniorproject.h"

class Seniorproject : public QMainWindow
{
	Q_OBJECT

public:
	Seniorproject(QWidget *parent = 0, Qt::WFlags flags = 0);
        	~Seniorproject();

//most likley using for varous signals
signals:


//most likley using for buttons 
private slots:

private:
	QLabel *label1;//Mode
	QLabel *label2;//IP Address
	QLineEdit *lineEdit;
	QPushButton *disconnectButton;
	QPushButton *connectButton;
	QPushButton *closeButton;
	Ui::SeniorprojectClass ui;
};

#endif // SENIORPROJECT_H





main.cpp
#include "seniorproject.h"
#include <QtGui/QApplication>

int main(int argc, char *argv[])
{
	QApplication a(argc, argv);
	Seniorproject *project = new Seniorproject;
	project->show();
	return a.exec();
}




Is This A Good Question/Topic? 0
  • +

Replies To: Visual Studio C++ Qt problem

#2 mi14chal  Icon User is offline

  • D.I.C Head

Reputation: 81
  • View blog
  • Posts: 202
  • Joined: 11-December 10

Re: Visual Studio C++ Qt problem

Posted 22 August 2011 - 08:20 AM

Perhaps change these lines:
Seniorproject *project = new Seniorproject;
	project->show();

to:
Seniorproject project;
	project.show();


And your program should work.
Was This Post Helpful? 0
  • +
  • -

#3 Snowsoman  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 25-October 10

Re: Visual Studio C++ Qt problem

Posted 22 August 2011 - 08:40 AM

Sorry i loaded the same code twice ,but I figured it out. In the file I did not include a line of code was the problem ,but thank you
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1