ich wollte mal ein wizard dialog erstellen nun klappt vorwärts und rückwärts
aber es geht nur nach der reihe nach..
wenn ich also
wenn ein radiobutton gechecked ist ,dann klick ich auf next,dann soll es mir das gewünschte
stackedwidget page anzeigen...
wie geht das?kann mir jemand helfen?
Code: Alles auswählen
include "AddFriendWizard.h"
#include <sstream>
#include <QContextMenuEvent>
#include <QMenu>
#include <QCursor>
#include <QPoint>
#include <QMouseEvent>
#include <QPixmap>
/** Constructor */
AddFriendWizard::AddFriendWizard(QWidget *parent, Qt::WFlags flags)
: QDialog(parent, flags)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
//GConfig config;
//config.loadWidgetInformation(this);
// connect up the buttons.
//connect( ui.cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancelChan( ) ) );
//connect( ui.createButton, SIGNAL( clicked ( bool ) ), this, SLOT( createChan( ) ) );
setFixedSize(QSize(508, 312));
/* Hide platform specific features */
#ifdef Q_WS_WIN
#endif
}
void AddFriendWizard::on_nextButton_clicked()
{
// The current index position
int index = ui.textstackedWidget->currentIndex();
// Test the different widgets
switch ( ui.textstackedWidget->currentIndex()) {
// Firewall buttons
case 1 :
{
if ( ui.keyradioButton->isChecked() )
{
break;
}
if ( ui.pqipemradioButton->isChecked() )
{
break;
}
break;
}
}
/*
* move to the next widget, with the signal/slot also labelstackedWidget,
* it's also moved
*/
index++;
// activate the backButton, because we are at the second widget or higher
ui.backButton->setEnabled(true);
// if lastStep is true, then we clicked the finish button
if ( lastStep )
{
// leave the dialog
accept();
}
/*
* if we are at the last widget or higher
* the >= is here because the button "Next" becomes the button "Finish" there
*/
if ( index >= ui.textstackedWidget->count() - 1 )
{
// the widget position is set to the last widget
index = ui.textstackedWidget->count() - 1;
// the button "Next" gets a new text: "Finish"
ui.nextButton->setText(tr("Finish"));
// we are at the last step, so we can finish here
lastStep = true;
}
else
{
lastStep = false;
}
ui.textstackedWidget->setCurrentIndex(index);
}
void AddFriendWizard::on_backButton_clicked()
{
int index = ui.textstackedWidget->currentIndex() - 1;
if ( index <= 0 )
{
index = 0;
ui.backButton->setEnabled(false);
}
ui.nextButton->setText(tr("Next"));
lastStep = false;
ui.textstackedWidget->setCurrentIndex(index);
}
/*!
* This function closes the dialog without saving the values
*/
void AddFriendWizard::on_cancelButton_clicked()
{
// if cancel is pressed, use the standard settings
//writeSettings();
// leave but show that cancel was pressed
reject();
}
ui.keyradioButton->isChecked
dann soll per ui.nextbutton der gewünschte stackedwidget "page_2" angezeit werden