SANKORE-137 implement tooltip, testing on Win7

preferencesAboutTextFull
ivan.ilyin 13 years ago
parent f6684fc7ea
commit 4e95d09c13
  1. 55
      src/gui/UBLibraryWidget.cpp
  2. 8
      src/gui/UBLibraryWidget.h

@ -533,6 +533,8 @@ UBNewFolderDlg::UBNewFolderDlg(QWidget *parent, const char *name):QDialog(parent
connect(mpButtons->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(accept()));
connect(mpButtons->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject()));
connect(mpLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(text_Changed(const QString &)));
connect(mpLineEdit, SIGNAL(textEdited(const QString &)), this, SLOT(text_Edited(const QString &)));
setMaximumHeight(100);
setMinimumHeight(100);
@ -578,3 +580,56 @@ QString UBNewFolderDlg::folderName()
{
return mpLineEdit->text();
}
void UBNewFolderDlg::text_Changed(const QString &newText)
{
}
/*
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx
< (less than)
> (greater than)
: (colon)
" (double quote)
/ (forward slash)
\ (backslash) // Note: The C++ compiler transforms backslashes in strings. To include a \ in a regexp, enter it twice, i.e. \\. To match the backslash character itself, enter it four times, i.e. \\\\.
| (vertical bar or pipe)
? (question mark)
* (asterisk)
*/
void UBNewFolderDlg::text_Edited(const QString &newText)
{
QString new_text = newText;
#ifdef Q_WS_WIN // Defined on Windows.
QString illegalCharList(" < > : \" / \\ | ? * ");
QRegExp regExp("[<>:\"/\\\\|?*]");
#endif
#ifdef Q_WS_QWS // Defined on Qt for Embedded Linux.
QString illegalCharList(" < > : \" / \\ | ? * ");
QRegExp regExp("[<>:\"/\\\\|?*]");
#endif
#ifdef Q_WS_MAC // Defined on Mac OS X.
QString illegalCharList(" < > : \" / \\ | ? * ");
QRegExp regExp("[<>:\"/\\\\|?*]");
#endif
#ifdef Q_WS_X11 // Defined on X11.
QString illegalCharList(" < > : \" / \\ | ? * ");
QRegExp regExp("[<>:\"/\\\\|?*]");
#endif
if(new_text.indexOf(regExp) > -1)
{
new_text.remove(regExp);
mpLineEdit->setText(new_text);
QToolTip::showText(mpLineEdit->mapToGlobal(QPoint()), "A file name can`t contain any of the following characters:\r\n"+illegalCharList);
}
}

@ -72,6 +72,7 @@ private slots:
void onSelectionChanged();
private:
void refreshView();
void generateItems();
void appendChainedElement(UBChainedLibElement* element, UBChainedLibElement* toElem);
@ -89,12 +90,19 @@ private:
class UBNewFolderDlg : public QDialog
{
Q_OBJECT
public:
UBNewFolderDlg(QWidget* parent=0, const char* name="NewFolderDlg");
~UBNewFolderDlg();
QString folderName();
public slots:
void text_Changed(const QString &);
void text_Edited(const QString &);
private:
QLabel* mpLabel;
QLineEdit* mpLineEdit;

Loading…
Cancel
Save