You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Sunday, December 18th 2011, 12:44pm

error in qt script

hi all,
i am writting a software with qt creator using qt library
when i added onclick function to kpushbutton
then i compiled it i got the error
/home/shubham/qt/untitled2-build-desktop/ui_mainwindow.h:24: error: kpushbutton.h: No such file or directory
i got they have added
#include<kpushbutton.h>
here is the ui_mainwindow.h code in which error comes

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#ifndef UI_MAINWINDOW_H
#define UI_MAINWINDOW_H

#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QHeaderView>
#include <QtGui/QLineEdit>
#include <QtGui/QMainWindow>
#include <QtGui/QMenuBar>
#include <QtGui/QStatusBar>
#include <QtGui/QToolBar>
#include <QtGui/QWidget>
#include "kpushbutton.h"

QT_BEGIN_NAMESPACE

class Ui_MainWindow
{
public:
	QWidget *centralWidget;
	QLineEdit *num1;
	QLineEdit *operator_2;
	QLineEdit *num2;
	QLineEdit *result;
	KPushButton *kpushbutton;
	QMenuBar *menuBar;
	QToolBar *mainToolBar;
	QStatusBar *statusBar;

	void setupUi(QMainWindow *MainWindow)
	{
    	if (MainWindow->objectName().isEmpty())
        	MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
    	MainWindow->resize(681, 404);
    	centralWidget = new QWidget(MainWindow);
    	centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
    	num1 = new QLineEdit(centralWidget);
    	num1->setObjectName(QString::fromUtf8("num1"));
    	num1->setGeometry(QRect(20, 10, 113, 27));
    	operator_2 = new QLineEdit(centralWidget);
    	operator_2->setObjectName(QString::fromUtf8("operator_2"));
    	operator_2->setGeometry(QRect(170, 10, 113, 27));
    	num2 = new QLineEdit(centralWidget);
    	num2->setObjectName(QString::fromUtf8("num2"));
    	num2->setGeometry(QRect(340, 10, 113, 27));
    	result = new QLineEdit(centralWidget);
    	result->setObjectName(QString::fromUtf8("result"));
    	result->setGeometry(QRect(10, 70, 461, 27));
    	kpushbutton = new KPushButton(centralWidget);
    	kpushbutton->setObjectName(QString::fromUtf8("kpushbutton"));
    	kpushbutton->setGeometry(QRect(510, 70, 55, 27));
    	MainWindow->setCentralWidget(centralWidget);
    	menuBar = new QMenuBar(MainWindow);
    	menuBar->setObjectName(QString::fromUtf8("menuBar"));
    	menuBar->setGeometry(QRect(0, 0, 681, 25));
    	MainWindow->setMenuBar(menuBar);
    	mainToolBar = new QToolBar(MainWindow);
    	mainToolBar->setObjectName(QString::fromUtf8("mainToolBar"));
    	MainWindow->addToolBar(Qt::TopToolBarArea, mainToolBar);
    	statusBar = new QStatusBar(MainWindow);
    	statusBar->setObjectName(QString::fromUtf8("statusBar"));
    	MainWindow->setStatusBar(statusBar);

    	retranslateUi(MainWindow);

    	QMetaObject::connectSlotsByName(MainWindow);
	} // setupUi

	void retranslateUi(QMainWindow *MainWindow)
	{
    	MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0, QApplication::UnicodeUTF8));
	} // retranslateUi

};

namespace Ui {
	class MainWindow: public Ui_MainWindow {};
} // namespace Ui

QT_END_NAMESPACE

#endif // UI_MAINWINDOW_H

tell me what is the problem this code is auto generated

2

Sunday, December 18th 2011, 2:37pm

what is a KPushbutton, and how did you add it to the form designer?

check case of kpushbutton.h and make sure it matches the file properly. I don't know how the include is generated from the ui file - you should check that out.
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

3

Monday, December 19th 2011, 5:10am

i added kpushbutton....

what is a KPushbutton, and how did you add it to the form designer?

check case of kpushbutton.h and make sure it matches the file properly. I don't know how the include is generated from the ui file - you should check that out.
i added kpushbutton to the from designer in the buttons(kde) section its a button see in the image
ubuntu has attached the following file:
  • qt-prob.jpg (115.66 kB - 3 times downloaded - latest: Dec 19th 2011, 10:14am)

4

Monday, December 19th 2011, 5:59am

Qpushbutton

i just tried Qpushbutton and it worked
whats the difference between kpushbutton and Qpushbutton
kpushbutton is not working so should i use Qpushbutton

5

Monday, December 19th 2011, 10:16am

did you do this?

check case of kpushbutton.h and make sure it matches the file properly.



"whats the difference between kpushbutton and Qpushbutton?"

Quoted


This [KPushButton] is nothing but a QPushButton with drag-support and KGuiItem support.

http://api.kde.org/4.5-api/kdelibs-apido…PushButton.html
Took ten seconds of googling
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

6

Tuesday, December 20th 2011, 12:35pm

thanks

did you do this?

check case of kpushbutton.h and make sure it matches the file properly.



"whats the difference between kpushbutton and Qpushbutton?"

Quoted


This [KPushButton] is nothing but a QPushButton with drag-support and KGuiItem support.

http://api.kde.org/4.5-api/kdelibs-apido…PushButton.html
Took ten seconds of googling
thanks