Added status bar framework.
This commit is contained in:
+48
-1
@@ -21,7 +21,8 @@
|
|||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QLabel>
|
#include <QStatusBar>
|
||||||
|
#include <QFrame>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@@ -40,6 +41,7 @@ namespace gLabels
|
|||||||
createActions();
|
createActions();
|
||||||
createMenus();
|
createMenus();
|
||||||
createToolBars();
|
createToolBars();
|
||||||
|
createStatusBar();
|
||||||
|
|
||||||
setDocVerbsEnabled( false );
|
setDocVerbsEnabled( false );
|
||||||
setPasteVerbsEnabled( false );
|
setPasteVerbsEnabled( false );
|
||||||
@@ -463,6 +465,27 @@ namespace gLabels
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::createStatusBar()
|
||||||
|
{
|
||||||
|
zoomInfoLabel = new QLabel( " 999% " );
|
||||||
|
zoomInfoLabel->setAlignment( Qt::AlignHCenter );
|
||||||
|
zoomInfoLabel->setMinimumSize( zoomInfoLabel->sizeHint() );
|
||||||
|
zoomInfoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
|
||||||
|
|
||||||
|
cursorInfoLabel = new QLabel;
|
||||||
|
cursorInfoLabel->setIndent( 3 );
|
||||||
|
cursorInfoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
|
||||||
|
|
||||||
|
statusBar()->addWidget( zoomInfoLabel );
|
||||||
|
statusBar()->addWidget( cursorInfoLabel, 1 );
|
||||||
|
|
||||||
|
updateZoomInfo( 1, false, false );
|
||||||
|
updateCursorInfo();
|
||||||
|
|
||||||
|
/* TODO: connect cursor and zoom signals to appropriate slots. */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set enabled state of actions associated with a document.
|
* Set enabled state of actions associated with a document.
|
||||||
*/
|
*/
|
||||||
@@ -920,5 +943,29 @@ namespace gLabels
|
|||||||
Help::displayAbout( this );
|
Help::displayAbout( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::updateZoomInfo( double zoom, bool min_flag, bool max_flag )
|
||||||
|
{
|
||||||
|
zoomInfoLabel->setText( QString( " %1% " ).arg(100*zoom, 0, 'f', 0) );
|
||||||
|
|
||||||
|
viewZoomInAction->setEnabled( !max_flag );
|
||||||
|
viewZoomOutAction->setEnabled( !min_flag );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::updateCursorInfo( double x, double y )
|
||||||
|
{
|
||||||
|
/* TODO: convert x,y to locale units and set precision accordingly. */
|
||||||
|
cursorInfoLabel->setText( QString( "%1, %2" ).arg(x).arg(y) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Clears cursor info. E.g. when pointer exits view. */
|
||||||
|
void MainWindow::updateCursorInfo()
|
||||||
|
{
|
||||||
|
cursorInfoLabel->setText( "" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
|
|
||||||
namespace gLabels
|
namespace gLabels
|
||||||
@@ -102,11 +103,16 @@ namespace gLabels
|
|||||||
void helpContents();
|
void helpContents();
|
||||||
void helpAbout();
|
void helpAbout();
|
||||||
|
|
||||||
|
void updateZoomInfo( double, bool, bool );
|
||||||
|
void updateCursorInfo();
|
||||||
|
void updateCursorInfo( double, double );
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createActions();
|
void createActions();
|
||||||
void createMenus();
|
void createMenus();
|
||||||
void createToolBars();
|
void createToolBars();
|
||||||
|
void createStatusBar();
|
||||||
|
|
||||||
void setDocVerbsEnabled( bool );
|
void setDocVerbsEnabled( bool );
|
||||||
void setDocModifiedVerbsEnabled( bool );
|
void setDocModifiedVerbsEnabled( bool );
|
||||||
@@ -134,6 +140,9 @@ namespace gLabels
|
|||||||
QToolBar *editToolBar;
|
QToolBar *editToolBar;
|
||||||
QToolBar *viewToolBar;
|
QToolBar *viewToolBar;
|
||||||
|
|
||||||
|
QLabel *zoomInfoLabel;
|
||||||
|
QLabel *cursorInfoLabel;
|
||||||
|
|
||||||
QAction *fileNewAction;
|
QAction *fileNewAction;
|
||||||
QAction *fileOpenAction;
|
QAction *fileOpenAction;
|
||||||
QAction *fileSaveAction;
|
QAction *fileSaveAction;
|
||||||
|
|||||||
Reference in New Issue
Block a user