#ifndef LSPROLISTITEM_H
#define LSPROLISTITEM_H
#include
#include
class LsproListItem : public QListWidgetItem
{
Q_OBJECT
public:
explicit LsproListItem(QString &text, QObject *parent = 0);
signals:
public slots:
};
#endif // LSPROLISTITEM_H
< /code>
Und dies ist meine CPP -Datei: < /p>
#include "lsprolistitem.h"
#include
LsproListItem::LsproListItem(QString & text, QObject *parent) :
QListWidgetItem(text, parent)
{
}
< /code>
Ich erhalte das Argument nicht von meinem benutzerdefinierten Konstruktor, um ein Objekt zu erstellen, das auf QListWidgetItem basiert.LsproListItem *simpleText = new LsproListItem("Lorem ipsum");
< /code>
, aber dies schlägt fehl mit: < /p>
appcms.cpp: error : no matching constructor for initialization of 'LsproListItem'
LsproListItem *simpleText = new LsproListItem("Lorem ipsum");
^ ~~~~~~~~~~~~~
lsprolistitem.h:7: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'const char [12]' to 'const LsproListItem' for 1st argument
class LsproListItem : public QListWidgetItem
^
lsprolistitem.h:: candidate constructor not viable: no known conversion from 'const char [12]' to 'QString &' for 1st argument
explicit LsproListItem(QString &text, QObject *parent = 0);
^
[url=viewtopic.php?t=14917]Ich möchte[/url] qlistwidgetItem subklassen, aber ich verstehe nicht, was ich falsch mache.[code]#ifndef LSPROLISTITEM_H #define LSPROLISTITEM_H
#include #include
class LsproListItem : public QListWidgetItem { Q_OBJECT public: explicit LsproListItem(QString &text, QObject *parent = 0); signals: public slots: };
Ich erhalte das Argument nicht von meinem benutzerdefinierten Konstruktor, um ein Objekt zu erstellen, das auf QListWidgetItem basiert.LsproListItem *simpleText = new LsproListItem("Lorem ipsum"); < /code>
, aber dies schlägt fehl mit: < /p>
appcms.cpp: error : no matching constructor for initialization of 'LsproListItem' LsproListItem *simpleText = new LsproListItem("Lorem ipsum"); ^ ~~~~~~~~~~~~~
lsprolistitem.h:7: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'const char [12]' to 'const LsproListItem' for 1st argument class LsproListItem : public QListWidgetItem ^ lsprolistitem.h:: candidate constructor not viable: no known conversion from 'const char [12]' to 'QString &' for 1st argument explicit LsproListItem(QString &text, QObject *parent = 0); ^ [/code]
In der iOS 16-Kalender-App gibt es einen neuen Dropdown-Menüstil für Optionen wie „Wiederholen“. Wenn Sie auf eine beliebige Stelle der Zeile tippen, wird ein Menü angezeigt. Und auf der rechten...
Ich entwickle die Web-App „react+asp.net“. Ich habe versucht, das API-Backend von asp.net mithilfe des https-Protokolls zu konfigurieren. Ich habe meine appsettings.json-Datei und Program.cs-Datei...