Sign up for the KDAB Newsletter
Stay on top of the latest news, publications, events and more.
Go to Sign-up
These are some really cool or obfuscated code snippets for your amusement. We didn't want to rate them, so the order doesn't mean anything at all :)
Just to make sure that there's no misunderstanding: This code really is/was in the Qt or KDE repositories.
if (!app.start()) {
delete splash;
return 1;
}
sleep(3);
delete splash;
app.exec();
static int gcd(int a, int b)
{
// ### Should use good method, but not speed critical.
int r = QMIN(a,b);
while ( a%r || b%r )
r--;
return r;
}
if (!strncmp((LPCSTR)Destination
#ifdef QT_20
.latin1()
#endif
, "file:", 5))
{
GoItem((LPCSTR) Destination
#ifdef QT_20
.latin1()
#endif
+ 5);
...
// OK. Get this. I'm not going to add 4 lines of code to this thing and
// nest it in another [infinite] loop just so someone can feel warm and
// fuzzy because they found a complicated way to avoid using a perfectly
// fine goto. This is my code and I like the goto just the way it is.
// Deal with it.
/*
Do a trial distribution and calculate how much it is off.
If there are more deficit pixels than surplus pixels, give
the minimum size items what they need, and repeat.
Otherwise give to the maximum size items, and repeat.
I have a wonderful mathematical proof for the correctness
of this principle, but unfortunately this comment is too
small to contain it.
*/
if ( name.lower() != "JPEG" )
((QLineEdit *) (m_search->children()->getFirst()))->selectAll();
tmp=tmp.setNum(m_Validity->dateMin.year())+"/"+
tmp.setNum(m_Validity->dateMin.month())+"/"+
tmp.setNum(m_Validity->dateMin.day());
void QLabel::buddyDied() // I can't remember if I cried.
/**
* The origin and purpose of this function is unknown, the ancient wisdom about it got lost during
* the centuries.
*
* Historicans believe that the intent of the function is to return the raw body of the mail,
* i.e. no charset decoding has been done yet. Sometimes CTE decoding has been done, sometimes
* not. For encrypted parts, this returns the content of the decrypted part. For a mail with
* multiple MIME parts, the results are conecated together. Not all parts are included in this.
*
* Although conecating multiple undecoded body parts with potentially different CTEs together might
* not seem to make any sense in these modern times, it is assumed that initially this function
* performed quite well, but the ancient scrolls got damaged with the ravages of time
* and were re-written multiple times.
*
* Do not use. Use plainTextContent() and htmlContent() instead.
*/
MESSAGEVIEWER_DEPRECATED_EXPORT QByteArray rawDecryptedBody() const<br>
static HitMeBabyOneMoreTime britney;
Happy Halloween, folks.
About KDAB
The KDAB Group is a globally recognized provider for software consulting, development and training, specializing in embedded devices and complex cross-platform desktop applications. In addition to being leading experts in Qt, C++ and 3D technologies for over two decades, KDAB provides deep expertise across the stack, including Linux, Rust and modern UI frameworks. With 100+ employees from 20 countries and offices in Sweden, Germany, USA, France and UK, we serve clients around the world.
Stay on top of the latest news, publications, events and more.
Go to Sign-up
Upgrade your applications from Qt 5 to Qt 6 with KDAB’s migration services. Get a free migration assessment and join a hands-on workshop to prepare your team for a successful transition!
Learn more
Learn Modern C++
Our hands-on Modern C++ training courses are designed to quickly familiarize newcomers with the language. They also update professional C++ developers on the latest changes in the language and standard library introduced in recent C++ editions.
Learn more
2 Comments
22 - Oct - 2021
Carl Schwan
I don't see any code snippet from NeoChat, I guess it means our code is perfect!
22 - Oct - 2021
David Faure
I didn't look into current code to avoid vexing anyone :-)