问题列表 - 第28905页

重置Qt样式表

我设法将我的QLineEdit设置为这样的样式:

替代文字http://www.kimag.es/share/54278758.png

void Utilities::setFormErrorStyle(QLineEdit *lineEdit)
{
    lineEdit->setStyleSheet(
            "background-color: #FF8A8A;"
            "background-image: url(:/resources/warning.png);"
            "background-position: right center;"
            "background-repeat: no-repeat;"
            "");
}
Run Code Online (Sandbox Code Playgroud)

我用这个函数调用了

Utilities *util = new Utilities;
util->setFormErrorStyle(lineNoStaf);
Run Code Online (Sandbox Code Playgroud)

流程应该是这样的:

  1. 用户打开表单
  2. 用户填写数据
  3. 用户提交数据
  4. 得到了错误
  5. 使用 setFormErrorStyle()
  6. 用户编辑QLineEdit中的文本,样式消失

此功能应该可以一遍又一遍地重复使用,但是如何将QLineEdit信号连接textChanged()到其他类中的功能,该功能将重置样式表,然后断开信号,使其在每次文本更改时都不会连续运行?

qt stylesheet signals-slots

2
推荐指数
1
解决办法
7282
查看次数

如何在iPhone应用程序中实现UIButton/UILabel'填充'

我的iPhone应用程序中有各种视图需要填充,例如左边是文本对齐的自定义UIButton,背景颜色为UILabel.

这可能是一个非常愚蠢的问题,但我如何应用'填充'来移动左边的文本?

我已经厌倦了使用边界等没有任何成功.

我知道我可以UILabel用背景颜色为我创建一个包装器视图,但它看起来有点矫枉过正.

非常感谢.

iphone padding uibutton uiview uilabel

60
推荐指数
5
解决办法
5万
查看次数

Windows 7中的"Android Create"调用失败 - 缺少JDK

我在Windows 7中设置android dev环境时遇到问题.我按照这里的说明,以及几个环境子链接.我正在使用带有Android插件的Eclipse.我已经在不同的位置安装了几次Java JDK(jdk-6u20-windows-i586.exe) - 但我显然遗漏了一些东西.

每次我运行"android create avd --target 2 --name my_avd"我都会收到错误消息:

    C:\Users\andrew>android create avd --target 2 --name my_avd

WARNING: Java not found in your path.
Checking it it's installed in C:\Program Files\Java instead.


ERROR: No suitable Java found. In order to properly use the Android Developer
Tools, you need a suitable version of Java installed on your system. We
recommend that you install the JDK version of JavaSE, available here:
  http://java.sun.com/javase/downloads/

You can find …
Run Code Online (Sandbox Code Playgroud)

java windows android windows-7

8
推荐指数
3
解决办法
1万
查看次数

如何重写 URL

我有一个使用 Seam 2.2、Richfaces 3.3、JBoss 5.1 构建的小应用程序。

大多数页面导航都会将请求参数添加到目标URL 中。我想隐藏对使用应用程序的客户隐藏的参数(例如,我希望 URL 类似于“ http://localhost:8080/books/Book.seam ”。参数(userId、orderId和 cmId)当前通过 Book.page.xml 映射到后端 bean。

如何防止请求参数显示在浏览器 URL 中,因为它还允许客户操纵 URL。

我们确实研究了接缝 URL 重写功能,它谈到了以 REST 格式操纵主键 ID,不知道如何以优雅的方式完成像上述用例这样更复杂的事情。

html jsf seam richfaces url-rewriting

5
推荐指数
1
解决办法
1536
查看次数

Spring - 将BindingResult添加到新创建的模型属性中

我的任务是 - 通过给定的请求参数创建模型属性,以验证它(以相同的方法)并将其整体提供给View.

我得到了这个示例代码:

@Controller
class PromotionController {

    @RequestMapping("promo")
    public String showPromotion(@RequestParam String someRequestParam, Model model) {
        //Create the model attribute by request parameters
        Promotion promotion = Promotions.get(someRequestParam); 

        //Add the attribute to the model
        model.addAttribute("promotion", promotion); 

        if (!promotion.validate()) {
            BindingResult errors = new BeanPropertyBindingResult(promotion, "promotion");
            errors.reject("promotion.invalid");
            //TODO: This is the part I don't like
            model.put(BindingResult.MODEL_KEY_PREFIX + "promotion", errors);
        }
        return 
    }
}
Run Code Online (Sandbox Code Playgroud)

这件事确实有效,但是使用MODEL_KEY_PREFIX和属性名称创建键的那部分看起来非常h​​ackish而不是Spring风格.有没有办法让同样的东西漂亮?

java code-formatting spring-mvc

18
推荐指数
1
解决办法
1万
查看次数

每次加载数据时都会调用 datagridview rowsremoved 事件

每次加载数据时都会调用 datagridview rowsremoved 事件。每次加载数据时,现有行都会被删除,这在一定程度上也是有意义的。因此从技术上讲,应该调用该事件。

但我如何区分它与实际按下的删除按钮。我认为不应该使用关键事件,这不是一个干净的方法。

任何帮助将不胜感激。

events datagridview winforms

4
推荐指数
1
解决办法
3457
查看次数

如何更新aspnetdb成员身份IsApproved值?

我需要在aspnet_Membership表中更新现有用户IsApproved状态.我有下面的代码,似乎没有工作.user.IsApproved属性已更新,但未将其保存到数据库表.我还需要打电话吗?
有什么建议?谢谢.

    /// <summary>
    /// Updates a users approval status to the specified value
    /// </summary>
    /// <param name="userName">The user to update</param>
    /// <param name="isApproved">The updated approval status</param>       
    public static void UpdateApprovalStatus(string userName, bool isApproved)
    {
       MembershipUser user = Membership.GetUser(userName);

       if (user != null)
           user.IsApproved = isApproved;          
    }
Run Code Online (Sandbox Code Playgroud)

asp.net asp.net-mvc asp.net-membership aspnetdb

2
推荐指数
1
解决办法
3963
查看次数

如何在oracle数据库中存储BigInteger值

我使用JDBC将Java程序连接到Oracle数据库.我想BigInteger在数据库中存储值(512位).列的类型应该是什么?

我是这样想的:

我在数据库中选了一个数字类型的列.

我转换BigIntegerBigDecimal这样的:

BigInteger b=new BigInteger("5779857570957802579079");
Number n =b;
BigDecimal d=(BigDecimal)n;

PreparedStatement pstmt=con.prepareStatemant("insert into database values(?,?)");
pstmt.setString(1,"john");
pstmt.setBigDecimal(2,d);
Run Code Online (Sandbox Code Playgroud)

我收到以下异常:

javax.servlet.ServletException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.math.BigDecimal
root cause 

java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.math.BigDecimal

这段代码片段有什么问题吗?如果有,请建议其他方法.

java oracle jdbc oracle10g

5
推荐指数
1
解决办法
1万
查看次数

如何在jQuery中对xml数据进行排序

我怎样才能officers根据他们的所有内容进行排序ranks

jQuery的

$.get('officers.xml', function(grade){
    $(grade).find('officer').each(function(){
        var $rank = $(this).attr('rank');
    });
});
Run Code Online (Sandbox Code Playgroud)

XML(officer.xml)

<grade>
 <officer rank="2"></student>
 <officer rank="3"></student>
 <officer rank="1"></student>
</grade>
Run Code Online (Sandbox Code Playgroud)

谢谢.

xml sorting jquery

6
推荐指数
1
解决办法
9205
查看次数

带有自定义依赖项属性的UserControl问题

我正在为一个名为SearchText的搜索文本编写一个带依赖项属性的用户控件.它是一个依赖属性,因为我想允许控件的使用者使用数据绑定.用户控件包含WPF TextBox,用户可以在其中输入搜索文本.

我可以使用数据绑定将用户控件的SearchText依赖项属性与TextBox的Text依赖项属性相连接,但此绑定仅在文本框丢失输入焦点时触发.我想要的是每次更改文本后都要更新的SearchText.所以我在用户控件中添加了一个TextChanged事件处理程序,我在其中将SearchText设置为Text的值.

我的问题是,SearchText绑定不起作用,源永远不会更新.我究竟做错了什么?

这是用户控件代码隐藏的相关部分:

public partial class UserControlSearchTextBox : UserControl
{
    public string SearchText
    {
        get { return (string)GetValue(SearchTextProperty); }
        set { SetValue(SearchTextProperty, value); }
    }

    public static readonly DependencyProperty SearchTextProperty =
        DependencyProperty.Register("SearchText", typeof(string), typeof(UserControlSearchTextBox), new UIPropertyMetadata(""));

    private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
    {
        SearchText = ((TextBox)sender).Text;
    }
    ...
}
Run Code Online (Sandbox Code Playgroud)

包含用户控件实例的窗口将其DataContext设置为具有也称为SearchText的属性的对象.

<uc:UserControlSearchTextBox SearchText="{Binding SearchText}" />
Run Code Online (Sandbox Code Playgroud)

Window的数据上下文:

public class DataSourceUserManual : DataSourceBase
{
    private string _searchText;
    public string SearchText
    {
        get { return _searchText; }
        set
        {
            _searchText = value; …
Run Code Online (Sandbox Code Playgroud)

c# data-binding wpf dependencies properties

5
推荐指数
1
解决办法
3220
查看次数