Coder Social home page Coder Social logo

cheatsh-qtcreator's Introduction

CheatSh-QtCreator

Plugin for QtCreator to view cheat sheets from cheat.sh

Download here

Introduction

Cheat.sh is a community-driven cheat sheets repository for programming languages, databases, linux tools and commands. It also searches StackOverflow if nothing is found in cheat.sh repository.

This plugin provides integrated access to cheat.sh from Qt Creator.

For example, you want to know how to get random number in a range. Instead of switching to documentaion or to browser you can search with plugin for random in range and read cheat sheet right inside Qt Creator.

Search examples: tie, RAII, random in range, measure time, reverse a list. QML/js function, Qt/resources, SQL/select, tar

Usage

From editor

Right-click on a word or selection and choose Search cheat.sh from popup menu. Or hit Alt + ⇧ Shift + c

Context menu example animation

Context menu example animation

From Locator

  1. Hit Ctrl + k to focus Locator
  2. Type ch <search term> to search in default context or cs /<context>/<search term> to override context for this search
Locator menu example animation

Locator example animation

Pasting results

Hit Alt + ⇧ Shift + v to paste result in text cursor position. Or right-click in text editor and select Paste result from context menu. Please note that most of the comments will be stripped and only the code will be pasted (Result of ?TQ request to cheat.sh).

Paste example animation

Locator example animation

Next/Previous answer

You can switch between answers by pressing "Next item" (F6) and "Previous item" (⇧ Shift + F6) buttons on the cheat.sh panel.

Next/Previous buttons

Useful settings

Plugin setting allows you to:

  • change default search context to your favorite language (default value is C++ language)
  • set custom URL to self-hosted cheat.sh instance
  • turn on and off displaying comments in results
  • disable update checks

Installation

To install plugin, please download suitable version from releases page. Then extract archive to user plugin directory:

  • Windows Vista and newer: "%LOCALAPPDATA%\QtProject\qtcreator\plugins\x.y.z". For example: c:\Users\Username\AppData\Local\QtProject\QtCreator\plugins\4.10.0\cheatsh.dll
  • Linux: "~/.local/share/data/QtProject/qtcreator/plugins/x.y.z" or "$XDG_DATA_HOME/data/QtProject/qtcreator/plugins/x.y.z" . For example "/home/user/.local/share/data/QtProject/qtcreator/plugins/4.10.0/cheatsh.so"

Please note:

  • for Qt Creator prior 4.9.0 plugin must be put into subdirectory with exact match to Qt Creator version (For example …/QtProject/qtcreator/plugins/4.8.2). Starting from 4.9.0 you can put plugin into subdirectory with lowest patch version (e.g. 4.9.0 instead of 4.9.2).
  • Qt Creator 4.9.x for Windows has broken SSL support so you should install OpenSSL manually.

Compilation

See INSTALL for more info about compilation from sources.

Build plugin

cheatsh-qtcreator's People

Contributors

pozemka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

isgursoy

cheatsh-qtcreator's Issues

Unable to build against Qt6 / Qt Creator 6

Here is CMake output:

-- The C compiler identification is GNU 11.1.0
-- The CXX compiler identification is GNU 11.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Found WrapAtomic: TRUE  
-- Found Threads: TRUE  
-- Found OpenGL: /usr/lib/libOpenGL.so   
-- Found WrapOpenGL: TRUE  
-- Could NOT find Vulkan (missing: Vulkan_INCLUDE_DIR) 
-- Found XKB: /usr/lib/libxkbcommon.so (found suitable version "1.3.0", minimum required is "0.5.0") 
-- Could NOT find Qt6Core5Compat (missing: Qt6Core5Compat_DIR)
CMake Warning at /usr/share/cmake-3.21/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
  Found package configuration file:

    /usr/lib64/cmake/Qt6/Qt6Config.cmake

  but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT
  FOUND.  Reason given by package:

  Failed to find Qt component "Core5Compat" config file at ""

  

Call Stack (most recent call first):
  /usr/lib64/cmake/Qt6Network/Qt6NetworkDependencies.cmake:8 (find_dependency)
  /usr/lib64/cmake/Qt6Network/Qt6NetworkConfig.cmake:50 (include)
  /usr/lib64/cmake/Qt6/Qt6Config.cmake:107 (find_package)
  /home/uni/bin/qtcreator-5.0.1/lib/cmake/QtCreator/FindQt5.cmake:57 (find_package)
  /usr/share/cmake-3.21/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /home/uni/bin/qtcreator-5.0.1/lib/cmake/QtCreator/QtCreatorConfig.cmake:16 (find_dependency)
  CMakeLists.txt:10 (find_package)


CMake Warning at /usr/lib64/cmake/Qt6/Qt6Config.cmake:107 (find_package):
  Found package configuration file:

    /usr/lib64/cmake/Qt6Network/Qt6NetworkConfig.cmake

  but it set Qt6Network_FOUND to FALSE so package "Qt6Network" is considered
  to be NOT FOUND.  Reason given by package:

  Qt6Network could not be found because dependency Qt6 could not be found.

Call Stack (most recent call first):
  /home/uni/bin/qtcreator-5.0.1/lib/cmake/QtCreator/FindQt5.cmake:57 (find_package)
  /usr/share/cmake-3.21/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /home/uni/bin/qtcreator-5.0.1/lib/cmake/QtCreator/QtCreatorConfig.cmake:16 (find_dependency)
  CMakeLists.txt:10 (find_package)


CMake Warning at /usr/share/cmake-3.21/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
  Found package configuration file:

    /usr/lib64/cmake/Qt6/Qt6Config.cmake

  but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT
  FOUND.  Reason given by package:

  Failed to find Qt component "Core5Compat" config file at ""

  Failed to find Qt component "Network" config file at ""

  

Call Stack (most recent call first):
  /usr/lib64/cmake/Qt6PrintSupport/Qt6PrintSupportDependencies.cmake:8 (find_dependency)
  /usr/lib64/cmake/Qt6PrintSupport/Qt6PrintSupportConfig.cmake:50 (include)
  /usr/lib64/cmake/Qt6/Qt6Config.cmake:107 (find_package)
  /home/uni/bin/qtcreator-5.0.1/lib/cmake/QtCreator/FindQt5.cmake:57 (find_package)
  /usr/share/cmake-3.21/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /home/uni/bin/qtcreator-5.0.1/lib/cmake/QtCreator/QtCreatorConfig.cmake:16 (find_dependency)
  CMakeLists.txt:10 (find_package)


CMake Warning at /usr/lib64/cmake/Qt6/Qt6Config.cmake:107 (find_package):
  Found package configuration file:

    /usr/lib64/cmake/Qt6PrintSupport/Qt6PrintSupportConfig.cmake

  but it set Qt6PrintSupport_FOUND to FALSE so package "Qt6PrintSupport" is
  considered to be NOT FOUND.  Reason given by package:

  Qt6PrintSupport could not be found because dependency Qt6 could not be
  found.

Call Stack (most recent call first):
  /home/uni/bin/qtcreator-5.0.1/lib/cmake/QtCreator/FindQt5.cmake:57 (find_package)
  /usr/share/cmake-3.21/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /home/uni/bin/qtcreator-5.0.1/lib/cmake/QtCreator/QtCreatorConfig.cmake:16 (find_dependency)
  CMakeLists.txt:10 (find_package)


-- Could NOT find Qt6Qml (missing: Qt6Qml_DIR)
-- Could NOT find Qt6Quick (missing: Qt6Quick_DIR)
-- Could NOT find Qt6QuickWidgets (missing: Qt6QuickWidgets_DIR)
CMake Warning at /usr/share/cmake-3.21/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
  Found package configuration file:

    /usr/lib64/cmake/Qt6/Qt6Config.cmake

  but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT
  FOUND.  Reason given by package:

  Failed to find Qt component "Core5Compat" config file at ""

  Failed to find Qt component "Network" config file at ""

  Failed to find Qt component "PrintSupport" config file at ""

  Failed to find Qt component "Qml" config file at ""

  Failed to find Qt component "Quick" config file at ""

  Failed to find Qt component "QuickWidgets" config file at ""

  

Call Stack (most recent call first):
  /usr/lib64/cmake/Qt6Sql/Qt6SqlDependencies.cmake:8 (find_dependency)
  /usr/lib64/cmake/Qt6Sql/Qt6SqlConfig.cmake:50 (include)
  /usr/lib64/cmake/Qt6/Qt6Config.cmake:107 (find_package)
  /home/uni/bin/qtcreator-5.0.1/lib/cmake/QtCreator/FindQt5.cmake:57 (find_package)
  /usr/share/cmake-3.21/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /home/uni/bin/qtcreator-5.0.1/lib/cmake/QtCreator/QtCreatorConfig.cmake:16 (find_dependency)
  CMakeLists.txt:10 (find_package)


CMake Warning at /usr/lib64/cmake/Qt6/Qt6Config.cmake:107 (find_package):
  Found package configuration file:

    /usr/lib64/cmake/Qt6Sql/Qt6SqlConfig.cmake

  but it set Qt6Sql_FOUND to FALSE so package "Qt6Sql" is considered to be
  NOT FOUND.  Reason given by package:

  Qt6Sql could not be found because dependency Qt6 could not be found.

Call Stack (most recent call first):
  /home/uni/bin/qtcreator-5.0.1/lib/cmake/QtCreator/FindQt5.cmake:57 (find_package)
  /usr/share/cmake-3.21/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /home/uni/bin/qtcreator-5.0.1/lib/cmake/QtCreator/QtCreatorConfig.cmake:16 (find_dependency)
  CMakeLists.txt:10 (find_package)


CMake Error at /home/uni/bin/qtcreator-5.0.1/lib/cmake/QtCreator/FindQt5.cmake:57 (find_package):
  Found package configuration file:

    /usr/lib64/cmake/Qt6/Qt6Config.cmake

  but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT
  FOUND.  Reason given by package:

  Failed to find Qt component "Core5Compat" config file at ""

  Failed to find Qt component "Network" config file at ""

  Failed to find Qt component "PrintSupport" config file at ""

  Failed to find Qt component "Qml" config file at ""

  Failed to find Qt component "Quick" config file at ""

  Failed to find Qt component "QuickWidgets" config file at ""

  Failed to find Qt component "Sql" config file at ""

  

Call Stack (most recent call first):
  /usr/share/cmake-3.21/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /home/uni/bin/qtcreator-5.0.1/lib/cmake/QtCreator/QtCreatorConfig.cmake:16 (find_dependency)
  CMakeLists.txt:10 (find_package)


-- Configuring incomplete, errors occurred!

Font settings

Get them from Editor (is it possible?) or allow manual set in options?

GLIBCXX_3.4.29

/opt/qtc/6/lib/qtcreator/plugins/libCheatSh.so: Cannot load library /opt/qtc/6/lib/qtcreator/plugins/libCheatSh.so: (/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /opt/qtc/6/lib/qtcreator/plugins/libCheatSh.so))

QtC 6 run file, prebuilt 2.0.2 release, GCC 10.3.0, Ubuntu 20.04.

Easy paste of results

Copy results to buffer or add some way to insert last result.

Meta+Shift+V is good combination for start

CI build failing

Probably better is to wait till toolkits on CI are updated and then redo CI from scratch

Some ?QT requests return paste results with ANSIEsc-codes

Can't reproduce but something just returned:

�[38;5;246m# C++�[39m
�[38;5;246m# �[39m
�[38;5;246m# C++ is an object-oriented programming language which provides facilities for low-level memory manipulation.�[39m
�[38;5;246m# It is widely used by big tech companies, such as, Amazon, Facebook, Google, and SpaceX�[39m
�[38;5;246m#�[39m
�[38;5;246m# To Compile: g++ my_script.cpp�[39m
�[38;5;246m# To Execute: ./a.out�[39m
�[38;5;246m#�[39m
�[38;5;246m# See also �[39m
�[38;5;246m#   C++ language cheat sheet at /c++/�[39m
�[38;5;246m#   list of pages:      /c++/:list�[39m
�[38;5;246m#   learn C++:          /c++/:learn�[39m
�[38;5;246m#   C++ one-liners:     /c++/:1line�[39m
�[38;5;246m#   C++ weirdness:      /c++/weirdness �[39m
�[38;5;246m#   search in pages:    /c++/~keyword�[39m

as paste result

Add "Loading" screen

Request to cheat.sh are not instant so it would be nice to notify user that request is still in progress.

Probably add a timeout too (Does QNetworkAccessManager already have timeout).

ssl don't work in pre-build QtCreator 4.9.2

But it works with 4.8.2, 4.10.2 and 4.11.0

4.8.2 and 4.9.2 are shipped with ssleay32 dll and 4.10.2 and 4.11.0 are shipped with libssl-1_1 and libcrypto-1_1 dlls

For now it is recommended to download OpenSSL and copy libraries to Qt Creator installation folder.

[not an issue] cheat.sh developer key

Mikhail hi,

please drop me a short email to igor AT chub.in: I will mail you a cheat.sh plugin developer key; we are almost ready to release a new cool feature that we discussed long ago: query suggestion. It generates some load, so before releasing it fully without any limitations, I would like to test with a smaller circle of developers, and roll it out gradually, that's why the developers keys. I believe, this feature will drastically improve usability of your plugin

Install didn't work

I copied the file for my Qt Creator Version, 4.1.2:

$ ls ~/.local/share/data/QtProject/qtcreator/plugins
libCheatSh.so

But Qt Creator does not see it and it's not listed in the plugins list. What could be wrong?

Thanks for making this!

Better icon

Need better icon for settings. I think icon sizes used in QtCreator settings are 24×24 and 48×48 White background (become transparent depending of theme), black foreground colors.

Qt Creator 4.14.0 - plugin is not working

Hi @pozemka ,

I upgraded from QtCreator 4.13 to 4.14 (64-bit Linux) and now the cheatsh plugin is no longer working.

Please check it and find below the error messages from Qt Creator.

Could not resolve dependency 'Core(4.13.0)'
Could not resolve dependency 'TextEditor(4.13.0)'

Unsolved dependency on Arch linux (libKSyntaxHighlighting.so.4)

This message occures on Qt Creator start:

Невозможно загрузить библиотеку /home/uni/.local/share/data/QtProject/qtcreator/plugins/4.11.0/libCheatSh.so: (libKSyntaxHighlighting.so.4: невозможно открыть разделяемый объектный файл: Нет такого файла или каталога)
Same happens with plugin build on system itself.

libKSyntaxHighlighting.so.4 is found under qt-creator-opensource-build-4.11.0/lib/qtcreator/ path

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.