-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathchooseofficewindow.cpp
42 lines (37 loc) · 1.46 KB
/
chooseofficewindow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "global.h"
#include "appver.h"
#include "chooseofficewindow.h"
#include "ui_chooseofficewindow.h"
chooseOfficeWindow::chooseOfficeWindow(windowsDispatcher *parent) :
QDialog(nullptr),
ui(new Ui::chooseOfficeWindow)
{
ui->setupUi(this);
windowsDispatcherObj = parent;
ui->companiesComboBox->hide();
// ui->companiesComboBox->setModel(windowsDispatcherObj->companiesModel);
// ui->companiesComboBox->setModelColumn(0);
// ui->companiesComboBox->setCurrentIndex(-1);
ui->officesComboBox->setModel(officesModel);
// QComboBox::setPlaceholderText(const QString&) https://bugreports.qt.io/browse/QTBUG-90595
ui->officesComboBox->setPlaceholderText(tr("<выберите офис>"));
ui->officesComboBox->setStyleSheet(commonComboBoxStyleSheet);
ui->officesComboBox->setModelColumn(1);
ui->officesComboBox->setCurrentIndex(-1);
}
chooseOfficeWindow::~chooseOfficeWindow()
{
delete ui;
}
void chooseOfficeWindow::accept()
{
// int comboBoxCompanyIndex = ui->companiesComboBox->currentIndex();
// userDbData->insert("current_company", windowsDispatcherObj->companiesModel->index(comboBoxCompanyIndex, 1).data().toInt());
int comboBoxOfficeIndex = ui->officesComboBox->currentIndex();
if (comboBoxOfficeIndex >= 0)
{
userDbData->currentOffice = officesModel->databaseIDByRow(comboBoxOfficeIndex);
emit officeChoosed();
this->deleteLater();
}
}