changeset 518:b69abcf480fe

[add] Feature Request ID 2080832 : Now showing the cursors current line and column number in the statusbars down right corner. http://universalindent.sf.net/issue/2080832 git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@758 59b1889a-e5ac-428c-b0c7-476e01d41282
author thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
date Sun, 14 Sep 2008 16:53:18 +0000
parents 1b3ee7b56fcc
children 26de0f77b6be
files src/mainwindow.cpp src/mainwindow.h
diffstat 2 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/mainwindow.cpp	Fri Sep 12 09:07:42 2008 +0000
+++ b/src/mainwindow.cpp	Sun Sep 14 16:53:18 2008 +0000
@@ -244,6 +244,10 @@
     // on the same line as before when turning preview on/off.
     textEditVScrollBar = txtedSourceCode->verticalScrollBar();
 
+    textEditLineColumnInfoLabel = new QLabel( tr("Line %1, Column %2").arg(1).arg(1) );
+    statusbar->addPermanentWidget(textEditLineColumnInfoLabel);
+    connect( txtedSourceCode, SIGNAL(cursorPositionChanged(int, int)), this, SLOT(setStatusBarCursorPosInfo(int, int)) );
+
     // Connect the text editor to dependent functions.
     connect( txtedSourceCode, SIGNAL(textChanged()), this, SLOT(sourceCodeChangedHelperSlot()) );
 	connect( txtedSourceCode, SIGNAL(linesChanged()), this, SLOT(numberOfLinesChanged()) );
@@ -1389,9 +1393,20 @@
 }
 
 
+/*!
+    \brief If the dropped in object contains urls/paths to a file, open that file.
+*/
 void MainWindow::showAboutDialog() {
 	QPixmap originalPixmap = QPixmap::grabWindow(QApplication::desktop()->screen()->winId());
 	qDebug("in main pixmap width %d, numScreens = %d", originalPixmap.size().width(), QApplication::desktop()->availableGeometry().width());
 	aboutDialogGraphicsView->setScreenshotPixmap( originalPixmap );
 	aboutDialogGraphicsView->show();
-}
\ No newline at end of file
+}
+
+
+/*!
+    \brief Sets the label in the status bar to show the \a line and \a column number.
+*/
+void MainWindow::setStatusBarCursorPosInfo( int line, int column ) {
+    textEditLineColumnInfoLabel->setText( tr("Line %1, Column %2").arg(line+1).arg(column+1) );
+}
--- a/src/mainwindow.h	Fri Sep 12 09:07:42 2008 +0000
+++ b/src/mainwindow.h	Sun Sep 14 16:53:18 2008 +0000
@@ -121,6 +121,7 @@
     Ui::toolBarWidget *toolBarWidget;
     IndentHandler *indentHandler;
     UpdateCheckDialog *updateCheckDialog;
+    QLabel *textEditLineColumnInfoLabel;
 
 protected:
     void closeEvent( QCloseEvent *event );
@@ -149,6 +150,7 @@
     void openFileFromRecentlyOpenedList(QAction* recentlyOpenedAction);
     void clearRecentlyOpenedList();
 	void showAboutDialog();
+    void setStatusBarCursorPosInfo(int line, int column);
 };
 
 #endif // MAINWINDOW_H