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::Ok), SIGNAL(clicked()), this, SLOT(accept()));
connect(mpButtons->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject())); 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); setMaximumHeight(100);
setMinimumHeight(100); setMinimumHeight(100);
@ -578,3 +580,56 @@ QString UBNewFolderDlg::folderName()
{ {
return mpLineEdit->text(); 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(); void onSelectionChanged();
private: private:
void refreshView(); void refreshView();
void generateItems(); void generateItems();
void appendChainedElement(UBChainedLibElement* element, UBChainedLibElement* toElem); void appendChainedElement(UBChainedLibElement* element, UBChainedLibElement* toElem);
@ -89,12 +90,19 @@ private:
class UBNewFolderDlg : public QDialog class UBNewFolderDlg : public QDialog
{ {
Q_OBJECT
public: public:
UBNewFolderDlg(QWidget* parent=0, const char* name="NewFolderDlg"); UBNewFolderDlg(QWidget* parent=0, const char* name="NewFolderDlg");
~UBNewFolderDlg(); ~UBNewFolderDlg();
QString folderName(); QString folderName();
public slots:
void text_Changed(const QString &);
void text_Edited(const QString &);
private: private:
QLabel* mpLabel; QLabel* mpLabel;
QLineEdit* mpLineEdit; QLineEdit* mpLineEdit;

Loading…
Cancel
Save