-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kolejny krok realizacji aplikacji Adresy Qt5
- Loading branch information
Showing
18 changed files
with
478 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#include "adresy.h" | ||
#include "ui_adresy.h" | ||
|
||
adresy::adresy(QWidget *parent) : | ||
QWidget(parent), | ||
ui(new Ui::adresy) | ||
{ | ||
ui->setupUi(this); | ||
|
||
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); | ||
|
||
nazwaLine = new QLineEdit; | ||
nazwaLine = ui->nazwaLine; | ||
nazwaLine->setReadOnly(true); | ||
|
||
adresText = new QTextEdit; | ||
adresText = ui->adresText; | ||
adresText->setReadOnly(true); | ||
|
||
dodajBtn = new QPushButton; | ||
dodajBtn = ui->dodajBtn; | ||
|
||
zapiszBtn = new QPushButton; | ||
zapiszBtn = ui->zapiszBtn; | ||
zapiszBtn->hide(); | ||
|
||
anulujBtn = new QPushButton; | ||
anulujBtn = ui->anulujBtn; | ||
anulujBtn->hide(); | ||
|
||
nastBtn = new QPushButton; | ||
nastBtn = ui->nastBtn; | ||
nastBtn->setEnabled(false); | ||
|
||
poprzBtn = new QPushButton; | ||
poprzBtn = ui->poprzBtn; | ||
poprzBtn->setEnabled(false); | ||
|
||
edytujBtn = new QPushButton; | ||
edytujBtn = ui->edytujBtn; | ||
edytujBtn->setEnabled(false); | ||
|
||
usunBtn = new QPushButton; | ||
usunBtn = ui->usunBtn; | ||
usunBtn->setEnabled(false); | ||
|
||
koniecBtn = new QPushButton; | ||
koniecBtn = ui->koniecBtn; | ||
koniecBtn->setEnabled(true); | ||
|
||
setWindowTitle(trUtf8("Prosta książka adresowa")); | ||
} | ||
|
||
adresy::~adresy() | ||
{ | ||
delete ui; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#ifndef ADRESY_H | ||
#define ADRESY_H | ||
|
||
#include <QWidget> | ||
#include <QLineEdit> | ||
#include <QTextEdit> | ||
#include <QPushButton> | ||
#include <QTextCodec> | ||
|
||
namespace Ui { | ||
class adresy; | ||
} | ||
|
||
class adresy : public QWidget | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit adresy(QWidget *parent = 0); | ||
~adresy(); | ||
|
||
private: | ||
Ui::adresy *ui; | ||
QPushButton *dodajBtn; | ||
QPushButton *zapiszBtn; | ||
QPushButton *anulujBtn; | ||
QPushButton *poprzBtn; | ||
QPushButton *nastBtn; | ||
QPushButton *edytujBtn; | ||
QPushButton *usunBtn; | ||
QPushButton *koniecBtn; | ||
QLineEdit *nazwaLine; | ||
QTextEdit *adresText; | ||
}; | ||
|
||
#endif // ADRESY_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
#include "adresy.h" | ||
#include "ui_adresy.h" | ||
|
||
adresy::adresy(QWidget *parent) : | ||
QWidget(parent), | ||
ui(new Ui::adresy) | ||
{ | ||
ui->setupUi(this); | ||
|
||
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); | ||
|
||
nazwaLine = new QLineEdit; | ||
nazwaLine = ui->nazwaLine; | ||
nazwaLine->setReadOnly(true); | ||
|
||
adresText = new QTextEdit; | ||
adresText = ui->adresText; | ||
adresText->setReadOnly(true); | ||
|
||
dodajBtn = new QPushButton; | ||
dodajBtn = ui->dodajBtn; | ||
|
||
zapiszBtn = new QPushButton; | ||
zapiszBtn = ui->zapiszBtn; | ||
zapiszBtn->hide(); | ||
|
||
anulujBtn = new QPushButton; | ||
anulujBtn = ui->anulujBtn; | ||
anulujBtn->hide(); | ||
|
||
nastBtn = new QPushButton; | ||
nastBtn = ui->nastBtn; | ||
nastBtn->setEnabled(false); | ||
|
||
poprzBtn = new QPushButton; | ||
poprzBtn = ui->poprzBtn; | ||
poprzBtn->setEnabled(false); | ||
|
||
edytujBtn = new QPushButton; | ||
edytujBtn = ui->edytujBtn; | ||
edytujBtn->setEnabled(false); | ||
|
||
usunBtn = new QPushButton; | ||
usunBtn = ui->usunBtn; | ||
usunBtn->setEnabled(false); | ||
|
||
koniecBtn = new QPushButton; | ||
koniecBtn = ui->koniecBtn; | ||
koniecBtn->setEnabled(true); | ||
|
||
connect(dodajBtn, SIGNAL(clicked()), this, SLOT(dodajKontakt())); | ||
connect(koniecBtn,SIGNAL(clicked()),this, SLOT(koniec())); | ||
|
||
setWindowTitle(trUtf8("Prosta książka adresowa")); | ||
} | ||
|
||
adresy::~adresy() | ||
{ | ||
delete ui; | ||
} | ||
|
||
void adresy::dodajKontakt() { | ||
staraNazwa = nazwaLine->text(); | ||
staryAdres = adresText->toPlainText(); | ||
|
||
nazwaLine->clear(); | ||
adresText->clear(); | ||
|
||
aktGui(dodajT); | ||
} | ||
|
||
void adresy::aktGui(Tryb tryb) { | ||
aktTryb=tryb; | ||
switch (aktTryb) { | ||
case dodajT: | ||
case edytujT: | ||
nazwaLine->setReadOnly(false); | ||
nazwaLine->setFocus(Qt::OtherFocusReason); | ||
adresText->setReadOnly(false); | ||
|
||
dodajBtn->setEnabled(false); | ||
edytujBtn->setEnabled(false); | ||
usunBtn->setEnabled(false); | ||
|
||
zapiszBtn->show(); | ||
anulujBtn->show(); | ||
|
||
nastBtn->setEnabled(false); | ||
poprzBtn->setEnabled(false); | ||
break; | ||
case nawigujT: | ||
if (kontakty.isEmpty()) { | ||
nazwaLine->clear(); | ||
adresText->clear(); | ||
} | ||
nazwaLine->setReadOnly(true); | ||
adresText->setReadOnly(true); | ||
dodajBtn->setEnabled(true); | ||
|
||
int ile=kontakty.size(); | ||
edytujBtn->setEnabled(ile >= 1); | ||
usunBtn->setEnabled(ile >=1 ); | ||
nastBtn->setEnabled(ile > 1); | ||
poprzBtn->setEnabled(ile > 1); | ||
|
||
zapiszBtn->hide(); | ||
anulujBtn->hide(); | ||
break; | ||
} | ||
} | ||
|
||
void adresy::koniec() { | ||
adresy::close(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#ifndef ADRESY_H | ||
#define ADRESY_H | ||
|
||
#include <QWidget> | ||
#include <QLineEdit> | ||
#include <QTextEdit> | ||
#include <QPushButton> | ||
#include <QTextCodec> | ||
|
||
namespace Ui { | ||
class adresy; | ||
} | ||
|
||
class adresy : public QWidget | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit adresy(QWidget *parent = 0); | ||
~adresy(); | ||
|
||
enum Tryb { nawigujT, dodajT, edytujT }; | ||
|
||
public slots: | ||
void dodajKontakt(); | ||
void koniec(); | ||
|
||
private: | ||
Ui::adresy *ui; | ||
QPushButton *dodajBtn; | ||
QPushButton *zapiszBtn; | ||
QPushButton *anulujBtn; | ||
QPushButton *poprzBtn; | ||
QPushButton *nastBtn; | ||
QPushButton *edytujBtn; | ||
QPushButton *usunBtn; | ||
QPushButton *koniecBtn; | ||
QLineEdit *nazwaLine; | ||
QTextEdit *adresText; | ||
|
||
QString staraNazwa; | ||
QString staryAdres; | ||
Tryb aktTryb; | ||
void aktGui(Tryb tryb); | ||
QMap<QString,QString> kontakty; | ||
|
||
}; | ||
|
||
#endif // ADRESY_H |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.