#include <qlabel.h>
#include <q3filedialog.h>
#include <QPixmap>
Go to the source code of this file.
§ centerWindow()
void centerWindow |
( |
QWidget * |
window | ) |
|
Definition at line 26 of file guiTools.cpp.
Referenced by TitleWidget::aboutProgram(), TitleWidget::albumStatistics(), TitleWidget::help(), main(), and TitleWidget::settings().
30 QRect appRec = qApp->mainWidget()->frameGeometry();
31 QRect windowRec = window->frameGeometry();
38 if(windowRec.width() < appRec.width())
39 { x = appRec.x() + ((appRec.width() - windowRec.width())/2); }
44 if(windowRec.height() < appRec.height())
45 { y = appRec.y() + ((appRec.height() - windowRec.height())/2); }
50 QRect screen = QApplication::desktop()->availableGeometry();
53 if(x + windowRec.width() > screen.width() )
54 x = screen.width() - windowRec.width();
61 if(y + windowRec.height() > screen.height() )
62 y = screen.height() - windowRec.height();
69 window->move( QPoint( x, y) );
§ clipPhotoText()
QString clipPhotoText |
( |
const QString |
in | ) |
|
§ clipText()
QString clipText |
( |
QString |
string, |
|
|
int |
lines, |
|
|
int |
lineWidth |
|
) |
| |
clip text to fit within numer of lines and max width
Definition at line 72 of file guiTools.cpp.
Referenced by SubalbumPreviewWidget::setText(), and PhotoPreviewWidget::setText().
81 QString building =
"";
82 QFontMetrics fm( qApp->font() );
85 while(
string.length() > 0 && lines > 0)
87 bool spaceFound =
false;
91 while(
string.length() > 0)
95 if(fm.width( QString(line + building +
string.at(0) ) ) < lineWidth )
97 building = building +
string.at(0);
101 if(
string.at(0) ==
' ')
103 line = line + building;
106 string =
string.remove(0, 1);
110 string =
string.remove(0, 1);
111 if(
string.length() == 0)
113 line = line + building;
122 if(!spaceFound || lines == 1)
125 building = building + string;
128 line = line + building;
129 if(fm.width( line ) > lineWidth )
131 while( fm.width(line +
"...") > lineWidth )
133 line.truncate( line.length() - 1);
144 result = result + line;