psemiletov / tea-qt

TEA text editor
https://tea.ourproject.org
GNU General Public License v3.0
89 stars 13 forks source link

reference to type 'const QString' could not bind to an rvalue of type 'char' #11

Closed ryandesign closed 7 years ago

ryandesign commented 7 years ago

Hello, I'm the maintainer of tea in MacPorts. tea 44.0.0 does not build for me on macOS Sierra 10.12.4:

In file included from document.cpp:42:
./document.h:156:8: warning: 'CTEAEdit::canInsertFromMimeData' hides overloaded virtual function [-Woverloaded-virtual]
  bool canInsertFromMimeData (const QMimeData *source);
       ^
/opt/local/libexec/qt4/Library/Frameworks/QtGui.framework/Versions/4/Headers/qplaintextedit.h:251:18: note: hidden overloaded virtual function 'QPlainTextEdit::canInsertFromMimeData' declared here: di
fferent qualifiers (const vs none)
    virtual bool canInsertFromMimeData(const QMimeData *source) const;
                 ^
In file included from document.cpp:42:
./document.h:159:14: warning: 'CTEAEdit::createMimeDataFromSelection' hides overloaded virtual function [-Woverloaded-virtual]
  QMimeData* createMimeDataFromSelection(); 
             ^
/opt/local/libexec/qt4/Library/Frameworks/QtGui.framework/Versions/4/Headers/qplaintextedit.h:250:24: note: hidden overloaded virtual function 'QPlainTextEdit::createMimeDataFromSelection' declared he
re: different qualifiers (const vs none)
    virtual QMimeData *createMimeDataFromSelection() const;
                       ^
document.cpp:543:95: warning: unused parameter 'fname' [-Wunused-parameter]
CSyntaxHighlighter::CSyntaxHighlighter (QTextDocument *parent, CDocument *doc, const QString &fname): QSyntaxHighlighter (parent) 
                                                                                              ^
document.cpp:1917:47: warning: unused parameter 'newBlockCount' [-Wunused-parameter]
void CTEAEdit::updateLineNumberAreaWidth (int newBlockCount)
                                              ^
document.cpp:2141:7: warning: unused variable 'ydiff' [-Wunused-variable]
  int ydiff = y2 - y1;
      ^
document.cpp:2274:36: error: reference to type 'const QString' could not bind to an rvalue of type 'char'
  QString new_text = sl_dest.join ('\n');
                                   ^~~~
/opt/local/libexec/qt4/Library/Frameworks/QtCore.framework/Versions/4/Headers/qstringlist.h:162:49: note: passing argument to parameter 'sep' here
inline QString QStringList::join(const QString &sep) const
                                                ^
document.cpp:2363:56: warning: unused parameter 'source' [-Wunused-parameter]
bool CTEAEdit::canInsertFromMimeData (const QMimeData *source)
                                                       ^
document.cpp:2484:7: warning: unused variable 'ydiff' [-Wunused-variable]
  int ydiff = y2 - y1;
      ^
document.cpp:2553:36: error: reference to type 'const QString' could not bind to an rvalue of type 'char'
  QString new_text = sl_dest.join ('\n');
                                   ^~~~
/opt/local/libexec/qt4/Library/Frameworks/QtCore.framework/Versions/4/Headers/qstringlist.h:162:49: note: passing argument to parameter 'sep' here
inline QString QStringList::join(const QString &sep) const
                                                ^
document.cpp:2573:56: error: reference to type 'const QString' could not bind to an rvalue of type 'char'
     QApplication::clipboard()->setText (sl_copy.join ('\n'));
                                                       ^~~~
/opt/local/libexec/qt4/Library/Frameworks/QtCore.framework/Versions/4/Headers/qstringlist.h:162:49: note: passing argument to parameter 'sep' here
inline QString QStringList::join(const QString &sep) const
                                                ^
7 warnings and 3 errors generated.
make: *** [document.o] Error 1

tea 43.1.0 builds fine on the same system.

psemiletov commented 7 years ago

Try to compile now, I've just fixed some issues related to QStringList::join.

ryandesign commented 7 years ago

Thanks! d3e82207997811930e56081a498ffec18a47f9a2 helped. There's one more similar change to be made, then it compiles:

--- document.cpp.orig
+++ document.cpp
@@ -2570,7 +2570,7 @@
   cursor.endEditBlock();

   if (! just_del)  
-     QApplication::clipboard()->setText (sl_copy.join ('\n'));
+     QApplication::clipboard()->setText (sl_copy.join ("\n"));
 }
psemiletov commented 7 years ago

Already fixed, but thanks! It was my fault - I forget to merge my inner Qt4-compatible branch with the main branch.