So far here is what I have:
My Header to use the (tools_contacts.h):
#ifndef TOOLS_CONTACTS_H
#define TOOLS_CONTACTS_H
//user interface items:
#include "ui_tools_contacts.h"
//Qt functions:
#include <QString>
class toolsContacts
: public QWidget,
private Ui
::toolsContacts {
Q_OBJECT
public:
//functions:
toolsContacts
(QWidget *parent
= 0);
private slots:
private:
};
#endif
#ifndef TOOLS_CONTACTS_H
#define TOOLS_CONTACTS_H
//user interface items:
#include "ui_tools_contacts.h"
//Qt functions:
#include <QString>
class toolsContacts : public QWidget, private Ui::toolsContacts {
Q_OBJECT
public:
//functions:
toolsContacts(QWidget *parent = 0);
private slots:
private:
};
#endif
To copy to clipboard, switch view to plain text mode
the tools_contacts.cpp:
#include <QtGui>
#include "tools_contacts.h"
//setup interface of main window:
setupUi(this);
}
#include <QtGui>
#include "tools_contacts.h"
//setup interface of main window:
toolsContacts::toolsContacts(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
To copy to clipboard, switch view to plain text mode
The test code to invoke it from my main window:
toolsContacts contactListTool(this);
ui.tableWidget->setCellWidget(1, 1, contactListTool);
toolsContacts contactListTool(this);
ui.tableWidget->setCellWidget(1, 1, contactListTool);
To copy to clipboard, switch view to plain text mode
I think I am close, however when I compile I get the following errors:
This I believe is from an issue somewhere within my class to use the UI file:
In file included from tools_contacts.h:5,
from calculatorform.h:15,
from calculatorform.cpp:3:
ui_tools_contacts.h:25: error: expected unqualified-id before "delete"
ui_tools_contacts.h:25: error: abstract declarator `QToolButton*' used as declaration
ui_tools_contacts.h:25: error: expected `;' before "delete"
ui_tools_contacts.h: In member function `void Ui_toolsContacts::setupUi(QWidget*)':
ui_tools_contacts.h:42: error: expected primary-expression before '=' token
ui_tools_contacts.h:43: error: expected primary-expression before '->' token
ui_tools_contacts.h:44: error: expected primary-expression before '->' token
ui_tools_contacts.h:45: error: expected primary-expression before '->' token
ui_tools_contacts.h: In member function `void Ui_toolsContacts::retranslateUi(QWidget*)':
ui_tools_contacts.h:57: error: expected primary-expression before '->' token
This comes from me not being able to tell the setCellWidget function that my toolsContacts is a widget:
error: no matching function for call to `QTableWidget::setCellWidget(int, int, toolsContacts&)'
Bookmarks