Qt: how can I make hyperlink in qpushbutton? - c++

hi I'm trying to make hyperlink in a QPushbutton.
I searched for information that mights help and I found this:
Qt - add a hyperlink to a dialog
this told me how can I use hyperlink at a dialog(or mainwindow.)
However, what I want to is to use hyperlink in the QMessagebox when appears after clicking QPushbutton.
I searched that if I can use qlabel in qmessagebox but I couldn't find any information..
How can I do this?
(Any other way I can apply to make hyperlink by clicking a second button is fine. What I'm trying to do is 1st. click a button and my program will get an url information. 2nd. clicking a second button and it will activate my url)

If all you want is clicking a second button and it will activate my url then you can use QDesktopServices::openUrl() to open a URL. It automatically uses the application the user has configured, i.e. the browser or mail programm depending on the type of URL you give it.

Related

Unable to click on button in pycharm

I have written the code as below but am unable to click on the search button.
I have used xpath and id ,not sure what is the error:
Search Button
Wait Until Page Contains Element xpath=.//[#id='gwt-uid-117']
Click Button xpath=.//[#id='gwt-uid-117']
Remove dot(.) and try this.
browser.find_element_by_xpath("//[#id='gwt-uid-117']").click()
or
Remove dot(.) and one slash(/) and try.
browser.find_element_by_xpath("/[#id='gwt-uid-117']").click()

Sitecore 8, MVC, Experience Editor: How to make a rendering refresh after a Field Editor Button has been used

We have a rendering listing the selected items in a TreeSelect in the current item. In our case we call them "Tags" (1)
We have added a Field Editor Button to the component to let the editor change selected items. (2) (As described on for example Adding a custom component)
When an editor clicks (2) the editor window (3) it is opened in a dialog. The editor may select different items(called tags in our case) using the TreeSelect.
When the editor presses the ok-button (4) the values are set.
Now to the problem:
The values are actually set as they get stored when the editor presses the Save button but we want our list on the page (1) to immediately reflect the set items when the editor presses the ok-button (4), i.e. before having to actually save the whole item.
How do we achieve that?
(I am in contacts with Sitecore support but so far I have not gotten any answers...)
Update
After a lot of conversation with the support we still have no useful solution.
We tried turning it into a field renderer displaying the links.
What worked was:
The field do get updated when you have edited it in the popup field editor. (but...)
It looks good the first time when page is loaded.
You can make a WebEdit button with commands to edit the field and add it as Custom button to the field (register <command name="webedit:fieldeditor" type="Sitecore.Shell.Applications.WebEdit.Commands.FieldEditor, Sitecore.Client"/> and set Click on the button to webedit:fieldeditor(command={3473DDA1-2983-493C-AF7A-054C75AA7AD3},fields=NameOfField where the guid points to itelf and an "Icon" is set on it.)
What didn't work was:
The field get updated by the raw value, not what I want to display. Server code is involved, but not in the rendering of html-code.
When I want to edit the value in the field editor, the value sent to the field editor is not the raw value but what actually is displayed on the page. (I guess this can be solved somehow)
The issue to the support turned into a feature request to let the server be involved in rendering the field, not just sending a new value to the JavaScript updating it. The server does the first rendering so when it already is involved in updating, it should be allowed to do the rendering the following times too.
We have decided to not spend more time on this right now (we have other things to do too.) and have a bad editor experience as the field not get updated until the editor actually saves the item.
Still we have no suitable solution for this issue. If you want to keep working on it and want a reference to my issue it is 439059.
This may not be useful here. I've done this in normal sites, but not in Sitecore. But, here's one possibility....
This is a situation where you would pass a callback function to the child popup window. This callback will cause the caller / parent window to re-read/re-load the information that was just updated by the child.
Example:
User presses (2) to open Editor Window(3) (Editor window is opened and the Callback function is passed as a parameter)
User presses "OK" button (4). The "OK" button event handler updates the changes, then calls the Callback function which re-loads the now updated information, and closes the popup window.
Once the popup closes, the parent window now displays the information that the popup/editor just updated.
This takes some client side javascript (jquery) development but it is quite do-able normally.

Like Button customization

I'm trying to implement the Facebook Like button into a site and basically what I want is a very simple button that when clicked likes the corresponding facebook page and then opens it in a new window. I don't want the comments or the faces or the count, just the button and when clicked I don't want the option to add a comment. It just likes the page and opens it in a new tab, nothing more.
Any help would be appreciated.
Use this link
http://developers.facebook.com/docs/reference/plugins/like/
You can find answer for your question . Simply select the Layout to box_count or button_count . You will get simple like button .
If you want to use the facebook like plugin, the only customizations you can do are available here:
http://developers.facebook.com/docs/reference/plugins/like/
This will also generate the code on html5/iframe/xfbml into your application.

Qt C++ - displaying the links in QText Browser

Right now I am displaying the result in QTextBrowser. Results will be something like /home/User/, /media/Arena/ etc i.e path to different folders. Now I want to open the folder in a window by clicking on this result which is displayed in QTextBrowser. But I have no ideas how to do that. So can anyone let me know how to do it.
Thanx in advance.
P.S. I am using QtCreator & see the image http://i53.tinypic.com/qyxp1s.png.
can you insert html rather than plain text into the QTextBrowser widget? then you can use a URL to describe the paths.
BasementCat's right. You can use setHtml QTextBrowser's method to set HTML into the widget. You'll then probably need to call setOpenLinks(false) to disable default behavior and connect custom slot to widget's anchorClicked(QUrl const&) signal to handle links.

Qt - add a hyperlink to a dialog

Is there a way to add a clickable hyperlink in a Qt Dialog? I.e. it should look like a hyperlink (blue text), and when you click on it, it should open the hyperlink in the browser. Something like that:
Use QLabel::setOpenExternalLinks(bool), and set text on label link text.