void WindowPosition::fitToScreen(float xfraction, float yfraction) { if (_window == nullptr) return; wxDisplay display(wxDisplay::GetFromWindow(_window)); // Pass the call fitToScreen(display.GetGeometry(), xfraction, yfraction); }
TableEditor::TableEditor(QWidget *parent): Editor(parent) { QVBoxLayout *layout = new QVBoxLayout(this); setLayout(layout); // toolbar _toolbar = new QWidget(this); layout->addWidget(_toolbar); _ui_toolbar = new Ui::TableEditorToolbar; _ui_toolbar->setupUi(_toolbar); _ui_toolbar->firstPageButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/allLeft"))); _ui_toolbar->previousPageButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/left"))); _ui_toolbar->nextPageButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/right"))); _ui_toolbar->lastPageButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/allRight"))); _ui_toolbar->refreshButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/refresh"))); _ui_toolbar->addRowButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/general/add"))); _ui_toolbar->deleteRowButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/general/remove"))); _ui_toolbar->commitButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/checked"))); _ui_toolbar->rollbackButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/rollback"))); _ui_toolbar->dumpDataButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/export"))); _tableView = new QTableView(this); _tableModel = new QSqlTableModel(_tableView /* TODO database connection */); _tableView->setModel(_tableModel); layout->addWidget(_tableView); // connections connect(_ui_toolbar->commitButton, SIGNAL(clicked()), _tableModel, SLOT(submitAll())); connect(_ui_toolbar->rollbackButton, SIGNAL(clicked()), _tableModel, SLOT(revertAll())); connect(_ui_toolbar->addRowButton, SIGNAL(clicked()), this, SLOT(addRow())); connect(_ui_toolbar->deleteRowButton, SIGNAL(clicked()), this, SLOT(deleteRows())); connect(_ui_toolbar->refreshButton, SIGNAL(clicked()), _tableModel, SLOT(select())); connect(_ui_toolbar->toolButtonExportImage, SIGNAL(clicked()),_imageView, SLOT(exportImage())); connect(_ui_toolbar->toolButtonZoomIn, SIGNAL(clicked()),_imageView,SLOT(zoomIn())); connect(_ui_toolbar->toolButtonZoomOut, SIGNAL(clicked()),_imageView, SLOT(zoomOut())); connect(_ui_toolbar->toolButtonFitToScreen, SIGNAL(clicked()),_imageView, SLOT(fitToScreen())); connect(_ui_toolbar->toolButtonOriginalSize, SIGNAL(clicked()),_imageView, SLOT(resetToOriginalSize())); connect(_ui_toolbar->toolButtonBackground, SIGNAL(toggled()),_imageView, SLOT(setViewBackground())); connect(_ui_toolbar->toolButtonOutline, SIGNAL(toggled()),_imageView, SLOT(setViewOutline())); connect(_ui_toolbar->toolButtonPlayPause, SIGNAL(clicked()),this, SLOT(playToggled())); connect(_file, SIGNAL(imageSizeChanged()),this, SLOT(imageSizeUpdated())); connect(_file, SIGNAL(openFinished()),_imageView, SLOT(createScene())); connect(_file, SIGNAL(openFinished()),this, SLOT(updateToolButtons())); connect(_file, SIGNAL(aboutToReload()),_imageView, SLOT(reset())); connect(_file, SIGNAL(reloadFinished()),_imageView, SLOT(createScene())); connect(_file, SIGNAL(isPausedChanged()),this, SLOT(updatePauseAction())); connect(_imageView, SIGNAL(scaleFactorChanged()),this, SLOT(scaleFactorUpdate())); }
void WindowPosition::initialise(wxTopLevelWindow* window, const std::string& windowStateKey, float defaultXFraction, float defaultYFraction) { // Set up events and such connect(window); // Load from registry if possible if (GlobalRegistry().keyExists(windowStateKey)) { loadFromPath(windowStateKey); } else { fitToScreen(defaultXFraction, defaultYFraction); } applyPosition(); }