src/gui/kernel/qclipboard.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
   294         return QString();
   294         return QString();
   295     }
   295     }
   296 
   296 
   297     const QByteArray rawData = data->data(QLatin1String("text/") + subtype);
   297     const QByteArray rawData = data->data(QLatin1String("text/") + subtype);
   298 
   298 
       
   299 #ifndef QT_NO_TEXTCODEC
   299     QTextCodec* codec = QTextCodec::codecForMib(106); // utf-8 is default
   300     QTextCodec* codec = QTextCodec::codecForMib(106); // utf-8 is default
   300     if (subtype == QLatin1String("html"))
   301     if (subtype == QLatin1String("html"))
   301         codec = QTextCodec::codecForHtml(rawData, codec);
   302         codec = QTextCodec::codecForHtml(rawData, codec);
   302     else
   303     else
   303         codec = QTextCodec::codecForUtfText(rawData, codec);
   304         codec = QTextCodec::codecForUtfText(rawData, codec);
   304     return codec->toUnicode(rawData);
   305     return codec->toUnicode(rawData);
       
   306 #else //QT_NO_TEXTCODEC
       
   307     return rawData;
       
   308 #endif //QT_NO_TEXTCODEC
   305 }
   309 }
   306 
   310 
   307 /*!
   311 /*!
   308     Returns the clipboard text as plain text, or an empty string if the
   312     Returns the clipboard text as plain text, or an empty string if the
   309     clipboard does not contain any text.
   313     clipboard does not contain any text.