So-da-le! Am Samstag, 19. Oktober 2002 21:20 schrieb Christian Weickhmann:
Hallo Leute! [...] blablabla bla
Danke für jede Hilfe! Christian
OK, hier also das Problem, dass keines mehr ist: Eine Klasse, die ich aus QTab erstellt habe, will partout nicht SLOTs akzeptieren (Trotz Q_OBJECT Makros). Ich war aber der Meinung, dass ich QTab bräuchte, weil ich die Klasse in ein QTabWidget einhängen wollte... Naja. Dem war nicht so: QWidget reicht als vererbende Klasse vollkommen aus. Zusammen mit dem Q_OBJECT Makro funzt es einwandfrei. BTW: Kann ich QTable irgendwie dazu bringen, beim Sortieren einer Spalte die ganze Zeile nach der Spalte zu sortieren? Tschüss, Christian
Attached:
// --------------- asfsportmanager.h // ... 8< ... // alles Wichtige ist bereits #included // class ASFSportManager : public KMainWindow { Q_OBJECT public: ASFSportManager(QWidget* parent=0, const char *name=0); ~ASFSportManager(); public slots: void beenden(); private: // Private methods QVBoxLayout *layout; QTabWidget *tab; tabview *s; tabview *k; KStatusBar *stat; KMenuBar *menue; QPopupMenu *hilfe, *sp_mgr, *verw, *assist; KIconLoader *il; }; // ... >8 ...
// --------------- asfsportmanager.cpp // ... 8< ... s = new tabview(tab, "schueler"); k = new tabview(tab, "kurse"); tab = new QTabWidget(this, "karteireiter"); tab->setGeometry(5, 15, 600, 500); tab->addTab(s, "&Schüler"); tab->addTab(k, "&Kurse"); // ... >8 ....
// --------------- tabview.h
#ifndef TABVIEW_H #define TABVIEW_H
#include
#include #include #include #include #include #include #include #include class tabview : public QTab, QWidget { Q_OBJECT // without this it compiles, but doesn't succeed connect() // with this line it doesn't even compile
public: tabview(QWidget *parent=0, const char *name=0); ~tabview(); void loadConnections();
private slots: void neueZeile(); void filtere(bool); void loescheZeile(); void zeigeDetails();
private: QTable *table; QHBoxLayout *main; QVBoxLayout *knoepfe; KPushButton *neu, *loeschen, *suchen, *details; KPushButton *filter; KIconLoader *il; }; #endif
// ------------ tabview.cpp
#include "tabview.h"
tabview::tabview(QWidget *parent, const char *name) { il = new KIconLoader();
table = new QTable(this);
neu = new KPushButton(QIconSet(QPixmap(il->loadIcon("wizard.png", KIcon::NoGroup))), (const QString)"", this); loeschen = new KPushButton(QIconSet(QPixmap(il->loadIcon("editdelete.png", KIcon::NoGroup))), (const QString)"", this); filter = new KPushButton(QIconSet(QPixmap(il->loadIcon("filter.png", KIcon::NoGroup))), (const QString)"", this); filter->setToggleButton(true); suchen = new KPushButton(QIconSet(QPixmap(il->loadIcon("find.png", KIcon::NoGroup))), (const QString)"", this); details = new KPushButton(QIconSet(QPixmap(il->loadIcon("folder_blue.png", KIcon::NoGroup))), (const QString)"", this);
main = new QHBoxLayout(this, QBoxLayout::LeftToRight); knoepfe = new QVBoxLayout(this, QBoxLayout::Down);
knoepfe->add(neu); knoepfe->add(loeschen); knoepfe->add(filter); knoepfe->add(suchen); knoepfe->add(details); knoepfe->addStretch(); main->addWidget(table); main->addLayout(knoepfe);
loadConnections(); }
tabview::~tabview(){ }
void tabview::neueZeile() { cerr << "New row\n"; } void tabview::loescheZeile(){ } void tabview::filtere(bool f){ } void tabview::zeigeDetails(){ } void tabview::loadConnections(){ connect(neu, SIGNAL(clicked()), SLOT(neueZeile()) ); connect(loeschen, SIGNAL(clicked()), SLOT(loescheZeile()) ); connect(filter, SIGNAL(toggled(bool)), SLOT(filtere(bool)) ); connect(details, SIGNAL(clicked()), SLOT(zeigeDetails()) ); }
-- Celebrate Hannibal Day this year. Take an elephant to lunch.