Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

QT: Slot Problem

Empfohlene Antworten

Veröffentlicht

Mein Problem is das ich garnichts mehr kompilieren kann ohne eine WallofFehlermeldungen zu bekommen die im zusammenhang mit dem moc haengen.

Das es is im warsten Sinne des Wortes eine Wall ist nur ein kleiner Ausschnitt der Fehlermeldung:


mocs\moc_TableWidget.cpp:11:2: #error "The header file 'TableWidget.cpp' doesn't include <QObject>

mocs\moc_TableWidget.cpp:18: error: 'uint' does not name a type

mocs\moc_TableWidget.cpp:38: error: 'QMetaObject' does not name a type

...
Selbst wenn ich in die TableWidget.cpp #include <QObject> mache zeigt er die selbe Fehlermeldung. app.pro

TEMPLATE = app

TARGET = 

DEPENDPATH += . src

INCLUDEPATH += .



# Input

HEADERS += src/TableWidget.cpp

SOURCES += main.cpp src/TableWidget.cpp



MOC_DIR = mocs

OBJECTS_DIR = obj

TableWidget.cpp

#ifndef RELATION_WIDGET_H

#define RELATION_WIDGET_H


#include <QWidget>

#include <QTablewidget>

#include <QLayout>

#include <QPushButton>

#include <QMessageBox>


class Relation : public QTableWidget {

      Q_OBJECT

      public: 

             Relation(QWidget *parent=0);               


      protected slots:

             void addRow();

};


Relation::Relation (QWidget *parent) {


  setColumnCount(1);  

  setRowCount(1);


}


void Relation::addRow() {


     setRowCount(rowCount()+1);


}


class RelationWidget: public QWidget {


      public:

             RelationWidget ( QWidget *parent=0 );

};


RelationWidget::RelationWidget (QWidget *parent) {  


  QVBoxLayout *layout = new QVBoxLayout;


  Relation *rel = new Relation;


  QPushButton *b1 = new QPushButton("Add Row");

  b1->resize(20,30);

  QObject::connect(b1,SIGNAL(clicked()),rel,SLOT(addRow()));


  layout->addWidget(rel);  

  layout->addWidget(b1);

  setLayout(layout); 


}


#endif

vielleicht findet ihr ja den Fehler ich hab im moment garkeine Ahnung warum dieser Fehler kommt. Ich hab mir doch extra ein Tutorial dazu angeschaut :(

#error "The header file 'TableWidget.cpp' ...

Offenbar hält Qt deine TableWidget.cpp für eine Headerdatei. Das ist schon mal merkwürdig.

Warum hat die Datei eigentlich Include-Guards (#ifndef/#define/#endif)? Die braucht man nur bei Headerdateien. Du bindest doch hoffentlich nicht .cpp-Dateien über Includedirektiven ein?

Nein es ist nur schon weis ich nich wie spaet und hab mich nur verschrieben statt .cpp soll das .h heissen =)

Kein Kopieren & Einfügen geht aus cmd schlecht :|

Jetz gehts :( pöses QT pöse Müdigkeit

Nein ... du hattest recht nur Müdigkeit > augen. Entschuldigung aber das passiert wenn man zuviel .cpp am tag eingibt.

Tip: rammmmscht nie alles in eine file auch wenns von nem tutorial kommt >_<

danke nochmal fuer die schnelle antwort und das um die uhrzeit :)

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.